Developer forum

Forum » Templates » XSLT Last Breadcrumb item

XSLT Last Breadcrumb item

Dmitrij Jazel
Reply
Hello DW guys,

I have a quick question here, couldn't find it here nut hoped that someone could have discussed the issue.
What I need is a little xslt snippet I can use in Breadcrumb xslt file.
As I have a breadcrumb, all I want is to have the last element (current page) not be a link. Instead just a plain text.

I have this script, but it does not seam to parse... 
<xsl:template match="//Page">
    <xsl:param name="depth"/>
      <img src="Files/Templates/Designs/Conclusion/img/BreadcrumbPil.png" class="breadcrumbDevider" alt="" /> 
		  
		<xsl:when test="@Active='True'">
			<xsl:value-of select="@MenuText" disable-output-escaping="yes"/>
		</xsl:when>
		<xsl:otherwise>
			<a><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:otherwise>
        <xsl:if test="count(Page)">
          <span class="B{@AbsoluteLevel}">
            <xsl:apply-templates select="Page">
              <xsl:with-param name="depth" select="$depth+1"/>
            </xsl:apply-templates>
          </span>
        </xsl:if>
  </xsl:template>


Some small xslt snippets that could help me with this one would be more than appreciated!

Kind regards,
Dmitrij

Replies

 
Vladimir
Reply
This post has been marked as an answer
Hi Dmitrij!
You just forgot about choose element:
        <xsl:choose>
          <xsl:when test="@Active='True'">
            ...
          </xsl:when>
          <xsl:otherwise>
            ...
          </xsl:otherwise>
        </xsl:choose>

VS2010 is very  comfortable editor for .xslt files

Best regards,
Vladimir

Votes for this answer: 0
 
Dmitrij Jazel
Reply
 Hi Vladimir,

And thanks alot for the help! as always ;-)
Really appreciate your help!
It worked like a charm...

Kind regards,
Dmitrij

Just if someone curious about the script here is the page template in the xslt file:
<xsl:template match="//Page">
    <xsl:param name="depth"/>
      <img src="Files/Templates/Designs/Conclusion/img/BreadcrumbPil.png" class="breadcrumbDevider" alt="" /> 
	  
		<xsl:choose>
			<xsl:when test="@Active='True'">

				<span class="lastBread"><xsl:value-of select="@MenuText" disable-output-escaping="yes"/></span>

			</xsl:when>
			<xsl:otherwise>
				<a><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:otherwise>
		</xsl:choose>
	  
	 
        <xsl:if test="count(Page)">
          <span class="B{@AbsoluteLevel}">
            <xsl:apply-templates select="Page">
              <xsl:with-param name="depth" select="$depth+1"/>
            </xsl:apply-templates>
          </span>
		  
        </xsl:if>
  </xsl:template>

 

You must be logged in to post in the forum