Here is a sample stylesheet that takes a parameter for the title:
Code:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:param name="title" select="'Community'"/>
<xsl:template match="second">
<xsl:text>2) </xsl:text>
<xsl:value-of select="@title"/>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="three[current()[three[@title = $title] | three/forth[@title = $title]]]"/>
</xsl:template>
<xsl:template match="three">
<xsl:text>3) </xsl:text>
<xsl:value-of select="@title"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
When I run that with Saxon against the input
Code:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<first name="level1" title="Small Business" alt="Small Business" link="/small-business.jsp">
<second name="level2" title="Products and Services" link="/products/small-business.jsp">
<three name="level3" title="Pickup" link="/business-commerical-pick-up/index.jsp"/>
<three name="level3" title="Dropoff" link="/dropoff.jsp"/>
</second>
</first>
<first title="Enterprise" link="/enterprise.jsp">
<second title="Solutions" link="/enterprise/index.jsp">
<three title="Constructions" link="/construction/index.jsp">
<forth title="C Solutions" link="/solutions/index.jsp"/>
</three>
<three title="Healthcare" link="/healthcare/index.jsp">
<forth title="Facility" link="/healthcare-facility-solutions/index.jsp"/>
<forth title="Community" link="/community-solutions.jsp"/>
</three>
</second>
<second title="Tractor" link="/enterprise/test.jsp"/>
</first>
</root>
the output is
Code:
2) Products and Services
2) Solutions
3) Constructions
3) Healthcare
2) Tractor