|
Subject: [xsl] node depth From: Bernie <berniecc@xxxxxxxxx> Date: Fri, 7 Sep 2007 13:26:28 +0200 |
Is there any way to find out the depth of the current element in a
recursive template? The XML is the following:
<webmap>
<section id='1'>
<section id='3'>
<label lang='es_ES'><![CDATA[Tu Ayuntamiento]]></label>
<section id='29'>
<label lang='es_ES'><![CDATA[El Alcalde]]></label>
</section>
<section id='30'>
<label lang='es_ES'><![CDATA[Agenda del Alcalde]]></label>
</section>
</section>
<section id='15'>
<label lang='es_ES'
href='GenteMayor/GenteMayor_es_ES.html'><![CDATA[Gente
Mayor]]></label>
<section id='46'>
<label lang='es_ES'><![CDATA[Programa de Vacaciones]]></label>
</section>
<section id='47'>
<label lang='es_ES'><![CDATA[Centros de Dia]]></label>
</section>
</section>
</section>
<webmap>
The XSLT template is the following:
<xsl:template match="section">
<xsl:if test="label!=''">
<li>
<xsl:choose>
<xsl:when test="label/@href!=''">
<a>
<xsl:attribute name="href">
<xsl:value-of select="label/@href" />
</xsl:attribute>
<xsl:value-of select="label" />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="label" />
</xsl:otherwise>
</xsl:choose>
</li>
<ul>
<xsl:apply-templates select="section" />
</ul>
</xsl:if>
</xsl:template>
-----------------------------
Bernie.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Connecting the Source and, Yaswanth | Thread | Re: [xsl] node depth, David Carlisle |
| RE: [xsl] Connecting the Source and, Yaswanth | Date | [xsl] Unable to use count function , Yaswanth |
| Month |