add and remove whitespace

Purdy

Usenet Archive
Joined
Dec 2, 2003
Messages
5
Reaction score
0
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>
 

Patrick TJ McPhee

Usenet Archive
Joined
Apr 2, 2000
Messages
269
Reaction score
0
% 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.
 

Purdy

Usenet Archive
Joined
Dec 2, 2003
Messages
5
Reaction score
0
&#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.
 

Patrick TJ McPhee

Usenet Archive
Joined
Apr 2, 2000
Messages
269
Reaction score
0
% &#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.
 

rob p

Usenet Archive
Joined
Dec 12, 2003
Messages
1
Reaction score
0
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top