I'am new to XSLT and need help
this is my XML source file:
<cars best-category="83">
<category id="1" name="SUV">
<category id = "50" name="BMW">
</category>
</category>
<category id="2" name="combi">
<category id = "60" name="Volkswagen">
<category id="102" name="4x4">
</category>
</category>
<category id = "83" name="Skoda">
</category>
<category id = "32" name="Seat">
</category>
</category>
<category id="12" name="another">
</category>
</cars>
and I need this result (select full name attribute path by best-category value):
<CATEGORYTEXT>combi | Skoda</CATEGORYTEXT>
my XSLT:
<xsl:for-each select="cars/category">
<CATEGORYTEXT>
<xsl:apply-templates select="category" >
<xsl:with-param name="text" >
<xsl:value-of select="@name" />
</xsl:with-param>
</xsl:apply-templates>
</CATEGORYTEXT>
</xsl:for-each
and my template:
<xsl:template match="category">
<xsl:param name="text" />
<xsl:if test="category">
<xsl:apply-templates select="category">
<xsl:with-param name="text">
<xsl:value-of select="$text" />
<xsl:text>
|
</xsl:text>
<xsl:value-of select="@name" />
</xsl:with-param>
</xsl:apply-templates>
</xsl:if>
<xsl:value-of select="$text" />
<xsl:text>
|
</xsl:text>
<xsl:value-of select="@name" />
</xsl:template>
bud I don't know, how filtered results by best-category value ... Can anyone help me ?
Thanks