By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,441 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,441 IT Pros & Developers. It's quick & easy.

add and remove whitespace

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
&#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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.