|
Subject: Re: [xsl] backtracking to find all parents till root[again] From: "Aron Bock" <aronbock@xxxxxxxxxxx> Date: Tue, 24 May 2005 15:04:02 +0000 |
<xsl:template match="/">
<xsl:variable name="find" select="'NextTime'"/> <xsl:template match="Value">
<xsl:text>Match Found: </xsl:text><xsl:value-of select="."/>
<xsl:text>
</xsl:text><xsl:apply-templates select="parent::SubConcept[1]"/> </xsl:template>
<xsl:template match="SubConcept">
<xsl:text>Parent: </xsl:text><xsl:value-of select="@name"/>
<xsl:text>
</xsl:text>How do I backtrack to the root element from the result-generating node? Hence if my given structure is of the form:
<Top> <SubConcepts> <SubConcept id="990" name="Level1"> <Child ref="567">Child1</Child> <Value ref="456">hasFeature BrokenBolt</Value> </SubConcept> <SubConcept id="456" name="BrokenBolt"> <Child ref="345">Child2</Child> <Value ref="123">hasProperty NextTime</Value> </SubConcept> </SubConcepts> </Top>
I find my result in the <Value ref="123"> node with the contained value 'Time'. I can find the parent of this with the @name
Match found: Next Parent: BrokenBolt Parent: Level1 Parent: SubConcepts
| Current Thread |
|---|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] backtracking to find all , Rahil | Thread | Re: [xsl] backtracking to find all , Rahil |
| Re: [xsl] RE: xsl-list Digest 24 Ma, Wendell Piez | Date | [xsl] From "flat" XML To Nested Sec, Nadia . Swaby |
| Month |