Long story short, I'm creating a three level navigation, which require different markup for each. "No sweat", said the optimistic developer, "I'll just hack it together with XSLT. I mean, how hard can it be?". This was my first mistake.
<xsl:template match="/NavigationTree">
<xsl:if test="count(//Page) > 0">
<ul class="floatLeft">
<xsl:apply-templates select="Page">
<xsl:with-param name="depth" select="1"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</xsl:template>
<xsl:template match="//Page">
<xsl:param name="depth"/>
<li>
<xsl:if test="count(Page)">
<ul>
<xsl:apply-templates select="Subpage">
<xsl:with-param name="depth" select="$depth+1"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="//Subpage">
<xsl:param name="depth"/>
<li class="test">
</li>
</xsl:template>
I know this is not the way to do it, but my initial logic was this:
For the first level, use the "Page" template.
If the depth is more than 1, use the "Subpage" template.
(Later, I would also need a third template, but let's not worry about that right now)
As you have probably already gathered, I'm a complete rookie when it comes to XSLT, but I hope you can see what I'm trying to achieve. My question is, is it even possible, and how would I go about it?