add and remove whitespace

Discussion in 'XML' started by Purdy, Dec 10, 2003.

  1. Purdy

    Purdy Guest

    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>
     
    Purdy, Dec 10, 2003
    #1
    1. Advertising

  2. In article <>,
    Purdy <> 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
     
    Patrick TJ McPhee, Dec 10, 2003
    #2
    1. Advertising

  3. Purdy

    Purdy Guest

    &#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.
     
    Purdy, Dec 11, 2003
    #3
  4. In article <>,
    Purdy <> 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
     
    Patrick TJ McPhee, Dec 11, 2003
    #4
  5. Purdy

    rob p Guest

    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!
     
    rob p, Dec 12, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. threecrans
    Replies:
    0
    Views:
    1,471
    threecrans
    Jul 3, 2003
  2. Ryan Stewart
    Replies:
    11
    Views:
    5,902
    Roedy Green
    Jun 10, 2004
  3. Oli Filth
    Replies:
    9
    Views:
    3,366
    Uncle Pirate
    Jan 17, 2005
  4. Replies:
    10
    Views:
    801
    Eric Brunel
    Dec 16, 2008
  5. MRAB
    Replies:
    3
    Views:
    408
Loading...

Share This Page