[xsl] Getting my text children

Subject: [xsl] Getting my text children
From: "Ignacio Vera" <nano@xxxxxxxxxxxxxxxx>
Date: Wed, 4 Dec 2002 09:48:28 -0000
Hello,

My problem is that i want to express something in just an XPath expression,
so here is a data example, all the problem in here is that we have mixed
content
and we want to get all the text that is child of A:

<root>
     <A>first<B>second</B>third</A>
 </root>

if you use text() you get 'first' (*Fist child node*) (We call it Small
content)

if you use "." you get 'firstsecondthird' (*All descendant text nodes*) (We
call it big content)

what to use when you want 'firstthird' (*Only child text nodes*)!!!! (We
call it content)

Not expressing it with an XPath you can write something like:

<xsl:template match = "root">
  <xsl:for-each select="child::A/child::text">
       <xsl:value-of select ="current()"/>
    < /xsl:for-each>
</xsl:template>

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?


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


Current Thread