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

Newbie Problem

Subject: Newbie Problem
From: "Keyur K" <kkeyur@xxxxxxxxxxx>
Date: Sat, 14 Aug 2004 10:53:39 +0000
keyur
Hello List,

I have a problem, I am not able to access any nodes/values from a Loop.

I have a sorted result tree fragment in a variable, I am using msxsl node-set to loop through it.
Now when I need to access the other nodes of the document I am not able to do so.


Pl. see below for the partial xsl and xml code. I have put two comments in the xsl file one where I need the external node values but not able to retrieve and second where I am able to retreive but do not need

How can I access the outer/external nodes inside the loop, I also tried using key() but it also didn't work inside the loop. It was working fine outside the loop.

P.S. This xsl code is a part of a bigger xsl file.

Any advice will be very helpful. Thanks in advance.

- Keyur


<!------------XSL Partial Code ------------>



<xsl:template match="//changes" mode="changeLog">


<!--firstName IS AVAILABLE HERE-->

<xsl:variable name="sortedList">
<xsl:for-each select="./old">
<xsl:sort select="@changeID" data-type="number" order="ascending"></xsl:sort>
<xsl:copy-of select="."></xsl:copy-of>
</xsl:for-each>
</xsl:variable>


<xsl:for-each select="msxsl:node-set($sortedList)/old">
<xsl:variable name="cID"><xsl:value-of select="@changeID"></xsl:value-of></xsl:variable>
<tr>


<!--firstName IS REQUIRED HERE BUT COULD NOT RETRIEVE-->

<td><xsl:value-of select="/wi:root/changeLog/log[@id = $cID]/@firstName" /></td>
<td><xsl:value-of select="./text()" /></td>
</tr>
</xsl:for-each>


</xsl:template>



<!------------XML Sample Code ------------>

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="abc.xsl"?>

<wi:root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wi="abcxyz">
<content>
<personalData>
<lastName>Douglas</lastName>
<firstName>Michael</firstName>
<hobbies>
cricket, music, dancing, singing
<changes>
<old changeID="2">Hobbies</old>
<old changeID="4">cricket, music, dancing</old>
<old changeID="3">cricket, music</old>
</changes>
</hobbies>
</personalData>
</content>
<changeLog>
<log id="1" userID="8" firstName="Teri" date="8/13/2004" />
<log id="2" userID="7" firstName="Matt" date="8/13/2004" />
<log id="3" userID="15" firstName="Stephen" date="8/13/2004" />
<log id="4" userID="26" firstName="Bob" date="8/13/2004" />
</changeLog>
</wi:root>


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.