Developer forum

Forum » Templates » Reverce breadcrumb

Reverce breadcrumb

Dmitrij Jazel
Reply
Hi guys,

I just wanted to ask you if there is any reasonable way to do something like this. As I would expect, this could probably be doable with special XSLT file that could construct Breadcrumb in reverse?

Could anyone have any suggestions/examples/guidelies or anything that could help on the issue?

Regards,
Dmitrij

Replies

 
Vladimir
Reply
Hi Dmitrij!
something like:
  <xsl:template match="/NavigationTree">
    <xsl:if test="count(//Page) &gt; 0">
      <xsl:for-each select="//Page[@InPath='True']">
        <xsl:sort select="position()" data-type="number" order="descending"/>

        <xsl:apply-templates select="."/>
      </xsl:for-each>
   </xsl:template>

  <xsl:template match="//Page">
	»
	<a style="text-decoration:none;">
        <xsl:attribute name="href"><xsl:value-of select="@FriendlyHref" disable-output-escaping="yes"/></xsl:attribute>
		<xsl:value-of select="@MenuText" disable-output-escaping="yes"/>
	</a>
  </xsl:template>

there is also other  variant: firstly find last element, then going up:

  <xsl:template match="/NavigationTree">
    <xsl:if test="count(//Page) &gt; 0">
      <xsl:apply-templates select="(//Page[@InPath='True'])[last()]"/>
    </xsl:if>
   </xsl:template>


  <xsl:template match="//Page">
	»
	<a style="text-decoration:none;">
        <xsl:attribute name="href"><xsl:value-of select="@FriendlyHref" disable-output-escaping="yes"/></xsl:attribute>
		<xsl:value-of select="@MenuText" disable-output-escaping="yes"/>
	</a>
    <xsl:if test="(..)[@InPath='True']">
      <xsl:apply-templates select=".."/>
    </xsl:if>
  </xsl:template>

Best regards,
Vladimir

 

You must be logged in to post in the forum