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

foreach, preceding-sibling::node() and following-sibl

Subject: foreach, preceding-sibling::node() and following-sibling::node()
From: "Mingqiang Yu" <myu@xxxxxxxx>
Date: Mon, 24 Oct 2005 19:21:03 -0600 (MDT)
for each preceding sibling
I have a question about xsl:for-each and the usage of
preceding-sibling::node() and following-sibling::node(). Here is a piece
of my xml file:

<abs>
Experiment regarding the theory of Langevin [see Abs.
<idlink>1905A01449</idlink>].  <i>in vacuo</i> and theory of the
ferromagnetic state [see Abs. <idlink>1914A00343</idlink>,
<idlink>1914A00344</idlink>].
</abs>

I want to extract the idlink out and make it a hyperlink. So, the output
will be:
Experiment regarding the theory of Langevin [see Abs.<a
href="url1">1905A01449</a><i>in vacuo</i> and theory of the ferromagnetic
state [see Abs. <a href="url2">1914A00343</a>, <a
href="url3">1914A00344</a>.

But how can I get the text content between two idlink node? I used the
following codes but as you can imagine, the preceding-sibling::node()
keeps adding all of the content before each idlink. Do you have any
experience on this subject?

<xsl:when test="idlink">
<xsl:for-each select="idlink">
<xsl:copy-of select="preceding-sibling::node()"/>
<xsl:variable name="idlinkVal">
<xsl:copy-of select="."/>
</xsl:variable>
<a href="javascript:frLink('FRLink','all', &quot;{$idlinkVal}&quot;);">
<xsl:value-of select="$idlinkVal"/>
</a>
<xsl:copy-of select="following-sibling::node()"/>
</xsl:for-each>
</xsl:when>

Thanks in advance.

Ming

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.