RE: [xsl] Flatten a sequence to a string in xslt 2.0

Subject: RE: [xsl] Flatten a sequence to a string in xslt 2.0
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Mon, 29 Mar 2004 18:23:56 +0200
> -----Original Message-----
> From: Andrew Welch [mailto:AWelch@xxxxxxxxxxxxxxx]
> 
> With this xml:
> 
> <root>
>   <node>hello</node>
>   <node>world</node>
> </root>
> 
> And this variable definition:
> 
> <xsl:variable name="foo" select="/root/node"/>
> 
> I get a sequence of two nodes rather than the string value of the first
> node (as in xslt 1.0)
> 

Hi,

The described effect happens in 1.0 also (by default).

Just use:

substring-after(.,string($foo))

or, to be able to choose exactly which node:

substring-after(.,$foo[1])

> how do I get from the sequence to a string? I hope I'm not being really
> dumb here and missing something obvious :)
> 

All hope in vain ;)

Never mind, hope it helps!

Cheers,

Andreas

Current Thread