[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
I was wondering if someone can help me work out a position issue I'm struggling with.
I've got some XML that has is in it :
<FMPReport>
<File>
<ScriptCatalog>
<Script>
<StepList>
<Step>
...
</Step>
<Step>
...
</Step>
<Step>
...
</Step>
<Step id="1" name="Perform Script" enable="True">
<Value>
<DisplayCalculation>
<Chunk type="FieldRef">
<Field id="32867" name="cPref Server Temp Folder" table="gPrefs" />
Then in the xslt I run a for each loop
<xsl:for-each select="/FMPReport/File/ descendant::Chunk[@type='FieldRef']/Field">
<xsl:call-template name="RESULTSET" />
</xsl:for-each>
which works fine, and I can get the data I need. I grab the name from the Step using :
<xsl:value-of select="ancestor::Step[1]/@name" />
But how do I grab the step number? For example I want to know that this is step 4 in this script, by counting how many <Step> elements there are in the current <Script> element. I thought it would just be :
<xsl:value-of select="ancestor::Step[1]/position ()"/>
But that doesn't work, and gives me a parsing error. Am I maybe going about the whole thing wrong?
[xsl] Finding the position of an ancestor
Subject: [xsl] Finding the position of an ancestor From: Nicholas Orr <nick@xxxxxxxxxxx> Date: Tue, 20 Dec 2005 13:40:07 +1100 |
I was wondering if someone can help me work out a position issue I'm struggling with.
I've got some XML that has is in it :
<FMPReport>
<File>
<ScriptCatalog>
<Script>
<StepList>
<Step>
...
</Step>
<Step>
...
</Step>
<Step>
...
</Step>
<Step id="1" name="Perform Script" enable="True">
<Value>
<DisplayCalculation>
<Chunk type="FieldRef">
<Field id="32867" name="cPref Server Temp Folder" table="gPrefs" />
Then in the xslt I run a for each loop
<xsl:for-each select="/FMPReport/File/ descendant::Chunk[@type='FieldRef']/Field">
<xsl:call-template name="RESULTSET" />
</xsl:for-each>
which works fine, and I can get the data I need. I grab the name from the Step using :
<xsl:value-of select="ancestor::Step[1]/@name" />
But how do I grab the step number? For example I want to know that this is step 4 in this script, by counting how many <Step> elements there are in the current <Script> element. I thought it would just be :
<xsl:value-of select="ancestor::Step[1]/position ()"/>
But that doesn't work, and gives me a parsing error. Am I maybe going about the whole thing wrong?
Thanks, Nick
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] stylesheet functions or n, Michael Kay | Thread | Re: [xsl] Finding the position of a, Kamal Bhatt |
[xsl] stylesheet functions or named, Haarman, Michael | Date | Re: [xsl] Finding the position of a, Kamal Bhatt |
Month |