Spaces after procesed values

P

Porthos

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
 
J

Joris Gillis

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
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,
 
P

Porthos

Joris said:
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
 
J

Joris Gillis

Or use the 'xsl:text' element:
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>
 
P

Patrick TJ McPhee

% >> <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.
 

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

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top