xsl-list
[Top] [All Lists]

RE: Flatten a sequence to a string in xslt 2.0

2004-03-29 09:23:56
-----Original Message-----
From: Andrew Welch [mailto:AWelch(_at_)piper-group(_dot_)com]

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