RE: [xsl] Getting my text children

Subject: RE: [xsl] Getting my text children
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 4 Dec 2002 10:30:23 -0000
> 
> But what we are looking for is a way to express it as an 
> XPath, I think there is no way using XPath 1.0, so let's go 
> and have a look to XPath 2.0. I have found something that 
> made me thing it could work, the new 'for' expression for 
> operating in sequences migth be the solution, si I have tried 
> something like:
> 
>       <xsl:value-of select = "for $x in 
> /child::A/child::text() return $x/current()"/>
> 
> It didn't work, I am using saxon 7.0, any suggestion?
> 

In XSLT 2.0 you can write:

<xsl:value-of select="A/text()" separator=""/>

If the separator attribute is present, xsl:value-of outputs all the
values in the sequence, not just the first. By default (for backwards
compatibility), it only outputs the first.

But you wanted an XPath solution: you can do the same thing using the
string-join function: string-join(A/text(), '')

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread