|
Subject: [xsl] Counting level of nodes beneath current (in XPATH) From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx> Date: Tue, 11 Jan 2005 12:02:28 +0000 |
X -> Y+ Y -> Z X? Z -> (textnode)
An example is like this: <X> <Y> <Z>lv 1</Z> <X> <Y> <Z>lv 2</Z> </Y> </X> </Y> <Y> <Z>lv 1</Z> <X> <Y> <Z>lv 2</Z> <X> <Y> <Z>lv 3</Z> </Y> </X> </Y> <Y> <Z>lv 2</Z> <X> <Y> <Z>lv 3</Z> </Y> </X> <X> <Y> <Z>lv 3</Z> <X> <Y> <Z>lv 4</Z> </Y> <Y> <Z>lv 4</Z> </Y> </X> </Y> </X> </Y> </X> </Y> </X>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$lv='1'">
<xsl:apply-templates select="Y[not(X)]" mode="One"/>
</xsl:when>
<xsl:when test="$lv='2'">
<xsl:apply-templates select="Y[not(X/Y/X)]" mode="Two"/>
</xsl:when>
...
<xsl:otherwise>
<xsl:apply-templates select="Y" mode="Zero"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template><xsl:template match="Y" mode="One"> <!-- Do some stuff --> <xsl:apply-templates select="Y[not(X)]" mode="One"/> </xsl:template>
Thank you! Ragulf Pickaxe :-|
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Re: XML Date/Time service, Daniel Bibbens | Thread | Re: [xsl] Counting level of nodes b, David Carlisle |
| [xsl] Re: XML Date/Time service upd, Pete Forman | Date | Re: [xsl] Counting level of nodes b, David Carlisle |
| Month |