[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Getting my text children

Subject: Getting my text children
From: "Ignacio Vera" <nano@xxxxxxxxxxxxxxxx>
Date: Wed, 4 Dec 2002 09:48:28 -0000
ignacio vera
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.