Subject: Re: [xsl] Newbie Problem From: Mike Trotman <mike.trotman@xxxxxxxxxxxxx> Date: Sat, 14 Aug 2004 12:23:56 +0100 |
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>
-- Datalucid Limited 8 Eileen Road South Norwood London SE25 5EJ United Kingdom
/ tel :0208-239-6810 mob: 0794-725-9760 email: mike.trotman@xxxxxxxxxxxxx
UK Co. Reg: 4383635 VAT Reg.: 798 7531 60
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Newbie Problem, Keyur K | Thread | [xsl] Retrieving the date of proces, Frans Englich |
[xsl] Newbie Problem, Keyur K | Date | Re: [xsl] grouping + global variabl, Wendell Piez |
Month |