Spaces after procesed values

Discussion in 'XML' started by Porthos, Jan 5, 2005.

  1. Porthos

    Porthos Guest

    When I pull any given attribute out of my XML file via an XSL file, a
    blank character (space) is appended after it. For example:

    XSL File
    ----------------------
    <xsl:value-of name="@path"><xsl:value-of name="@file">.doc

    Result File
    ----------------------
    C:\word_docs\ randomfilename .doc

    I want to be able to pull multiple attributes and display them as one
    line with no breaks/spaces; something more like this:

    Result File
    ----------------------
    C:\word_docs\randomfilename.doc

    Now, I could use concat to pull them all together, or even a string
    variable. But is there a way to override the behavior that adds the
    space in the first place?

    Thanks,

    -jne
     
    Porthos, Jan 5, 2005
    #1
    1. Advertising

  2. Porthos

    Joris Gillis Guest

    Hi,

    > When I pull any given attribute out of my XML file via an XSL file, a
    > blank character (space) is appended after it. For example:
    >
    > XSL File
    > ----------------------
    > <xsl:value-of name="@path"><xsl:value-of name="@file">.doc
    >

    I assume your actual XSL looks like this:
    <xsl:value-of name="@path"/>
    <xsl:value-of name="@file"/>
    ..doc

    To avoid the whitespace in text nodes of the result tree, either put evrything on one line:
    <xsl:value-of name="@path"/><xsl:value-of name="@file"/>.doc

    Or use the 'xsl:text' element:
    <xsl:text><xsl:value-of name="@path"/></xsl:text>
    <xsl:text><xsl:value-of name="@file"/></xsl:text>
    <xsl:text>.doc</xsl:text>

    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    "Quot capita, tot sententiae" - Terentius , Phormio 454
     
    Joris Gillis, Jan 5, 2005
    #2
    1. Advertising

  3. Porthos

    Porthos Guest

    Joris Gillis wrote:
    > I assume your actual XSL looks like this:
    > <xsl:value-of name="@path"/>
    > <xsl:value-of name="@file"/>
    > .doc

    Yes, you are correct.

    > To avoid the whitespace in text nodes of the result tree, either put

    evrything on one line:
    Unfortunatly, due to the structure of what I'm writing, multiple lines
    are nescesary.

    > Or use the 'xsl:text' element:
    > <xsl:text><xsl:value-of name="@path"/></xsl:text>

    This is the functionality that I'm looking for. However, XMLSpy and
    Internet Explorer give me the following error: "Keyword xsl:text may
    not contain xsl:value-of". Is there another option?

    Thanks,

    -James
     
    Porthos, Jan 5, 2005
    #3
  4. Porthos

    Joris Gillis Guest

    >> Or use the 'xsl:text' element:
    >> <xsl:text><xsl:value-of name="@path"/></xsl:text>

    > This is the functionality that I'm looking for. However, XMLSpy and
    > Internet Explorer give me the following error: "Keyword xsl:text may
    > not contain xsl:value-of". Is there another option?

    I can hardly believe that.
    The error is rather the 'name' attribute; it should be 'select'
    <xsl:text><xsl:value-of select="@path"/></xsl:text>

    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    "Quot capita, tot sententiae" - Terentius , Phormio 454
     
    Joris Gillis, Jan 5, 2005
    #4
  5. In article <>,
    Joris Gillis <> wrote:
    % >> Or use the 'xsl:text' element:
    % >> <xsl:text><xsl:value-of name="@path"/></xsl:text>
    % > This is the functionality that I'm looking for. However, XMLSpy and
    % > Internet Explorer give me the following error: "Keyword xsl:text may
    % > not contain xsl:value-of". Is there another option?
    % I can hardly believe that.

    Why not? xsl:text may not contain xsl:value-of. What the OP wants is
    something like this:

    <xsl:value-of select='@path'/>
    <xsl:value-of select='@file'/>
    <xsl:text>.doc</xsl:text>

    The key is to represent all the literal text using <xsl:text> elements.
    If you do this, whitespace will be ignored. If you have any literal
    text which is not represented using xsl:text, all the whitespace will
    be copied to the result tree in text nodes.
    --

    Patrick TJ McPhee
    North York Canada
     
    Patrick TJ McPhee, Jan 6, 2005
    #5
  6. Porthos

    Porthos Guest

    It worked like a charm. Thanks Patrick.

    -James
     
    Porthos, Jan 6, 2005
    #6
    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. John B. Matthews
    Replies:
    4
    Views:
    684
    John B. Matthews
    Sep 12, 2008
  2. Roedy Green
    Replies:
    3
    Views:
    646
  3. Tomasz Chmielewski

    [CSS] how can I show spaces as spaces?

    Tomasz Chmielewski, Sep 5, 2009, in forum: HTML
    Replies:
    21
    Views:
    1,660
    Jan C. Faerber
    Sep 10, 2009
  4. Tomasz Chmielewski

    how can I show spaces as spaces, part 2

    Tomasz Chmielewski, Sep 9, 2009, in forum: HTML
    Replies:
    14
    Views:
    905
    Jan C. Faerber
    Sep 10, 2009
  5. johkar
    Replies:
    2
    Views:
    3,002
    Mayeul
    Dec 10, 2009
Loading...

Share This Page