472,351 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

add and remove whitespace

I have an asp.net application.

i export to excel, in exporting to excel i use an xslt to define the
columns and look.

on one of the fields i need the word 'qty' but i need it to look like
' qty' with 5 white spaces. i am able to do that in my xslt and
the export to Excel looks fine also.

but then i have another app i feed this excel sheet to, and in that
app (vbscript) i use trim(qtyField) but it doesn't remove the white
spaces out of the excel app.

if i do it manually without the xslt (place the white spaces in the
qty field), the vbscript app trims the white spaces just fine.

i don't know why??
anyone have any ideas? thx.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp " ">]>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="/">
<HTML>
<HEAD>
<STYLE>
.HDR { background-color:bisque;font-weight:bold }
</STYLE>
</HEAD>
<BODY>
<TABLE border="1">
<tr>
<TD CLASS="HDR" align="Center" >Qty</TD>
</tr>
<tr>
<TD fONT="Arial" >       QTY</TD>
</tr>

<xsl:for-each select="NewDataSet/Table1" >
<tr>
<TD><xsl:value-of select="Qty"/></TD>
</tr>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Jul 20 '05 #1
4 8395
In article <ca**************************@posting.google.com >,
Purdy <pu*****@hotmail.com> wrote:

% on one of the fields i need the word 'qty' but i need it to look like
% ' qty' with 5 white spaces. i am able to do that in my xslt and
% the export to Excel looks fine also.

[...]

% <TD fONT="Arial" >       QTY</TD>

  is a non-breakable space, which looks like a space, but is not one.
You could try , or just a space.
--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #2
&#160 did come thru as a space in excel which was what i wanted but it
wouldnt strip when i did trim(qty).
i tried a space but when it came thru in excel the space wasn't there.
i also tried  and that didn't work either.
  is a non-breakable space, which looks like a space, but is not one.
You could try , or just a space.

Jul 20 '05 #3
In article <ca**************************@posting.google.com >,
Purdy <pu*****@hotmail.com> wrote:
% &#160 did come thru as a space in excel which was what i wanted but it
% wouldnt strip when i did trim(qty).

My guess is that it came through as  , which looks like a space,
but is not one. How about explicitly changing chr(160) to space before
trimming?

Or, you could deal with your real problem -- if you require five spaces,
in your input, you're doing something wrong, probably in the way you're
formatting your document.

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #4
i inherited this app from someone prior to me. you are right in saying
it shouldn't be progrmd this way.
i took out the spaces and i could have put my life on the fact it
wouldn't accept the data without 5 spaces, but now it's taking it
without any spaces so this is a closed discussion. thx for your help!
i'll keep it in mind on future projects. :0)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Thomas Mlynarczyk | last post by:
Which is the simplest way to remove all whitespace from a string? Is there a simpler method than a regex replace? Or how can I tell a regex pattern...
5
by: McKirahan | last post by:
I'd like to use regular expressions to remove extraneous Carriage Return Line Feeds (CrLf) from a textarea before the form is submitted. I'd like...
3
by: Aaron | last post by:
is there a way to remove all white spaces in the html output? ie. everything as one line.
5
by: Donald Canton | last post by:
What's the best way to remove trailing whitespace from a string? For example: "John C. Doe \t" would become "John C. Doe". Thanks.
3
by: VK | last post by:
If it was already answered somewhere, I'll be glad to be pointed to (after the necessary comments on my search abilities :-) I need as...
7
by: Bosconian | last post by:
I know that str.replace(/^\s+|\s+$/g,''); will trim a string of space, but what about removing extra spaces from the middle? Where ...
10
by: Hermann.Richter | last post by:
Is there any way to remove automatically all blank chars from the html sent to the client?? Example:...
15
by: CI | last post by:
I have the following XML file <Book> <Chapters> <Chapter number="1"/> <Chapter number="2"/> </Chapters> <Colors> <Color RGB="255"/> <Color...
15
by: morleyc | last post by:
Hi, i would like to remove a number of characters from my string (\t \r \n which are throughout the string), i know regex can do this but i have no...
4
by: howa | last post by:
Consider an example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <style> a {...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.