Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Spaces after procesed values

Reply
Thread Tools

Spaces after procesed values

 
 
Porthos
Guest
Posts: n/a
 
      01-05-2005
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

 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      01-05-2005
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-v...i?userid=38041)
"Quot capita, tot sententiae" - Terentius , Phormio 454
 
Reply With Quote
 
 
 
 
Porthos
Guest
Posts: n/a
 
      01-05-2005



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

 
Reply With Quote
 
Joris Gillis
Guest
Posts: n/a
 
      01-05-2005
>> 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-v...i?userid=38041)
"Quot capita, tot sententiae" - Terentius , Phormio 454
 
Reply With Quote
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      01-06-2005
In article <(E-Mail Removed)>,
Joris Gillis <(E-Mail Removed)> 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
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Porthos
Guest
Posts: n/a
 
      01-06-2005
It worked like a charm. Thanks Patrick.

-James

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSD to allow A-Z 0-9 and spaces, but not leading/trailing spaces johkar XML 2 12-10-2009 09:24 AM
[CSS] how can I show spaces as spaces? Tomasz Chmielewski HTML 21 09-10-2009 06:43 PM
how can I show spaces as spaces, part 2 Tomasz Chmielewski HTML 14 09-10-2009 03:54 PM
Re: How to trim a String trailing spaces, but not leading spaces? Roedy Green Java 3 09-14-2008 02:10 AM
Re: How to trim a String trailing spaces, but not leading spaces? John B. Matthews Java 4 09-12-2008 05:28 AM



Advertisments