Umbraco XSLT Attributes must come immediately after the enclosing tag
Just spent a frustrating 2 hours trying to get this to work to highlight a specific navigation element
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
<xsl:if test="$currentPage/ancestor-or-self::node/@id=@id">
<xsl:attribute name="class">selected</xsl:attribute>
</xsl:if>
</a>
It gives an XSLT error when trying to save because the attribute statement is after the content of the tag (the <xsl:value-of select="@nodeName"/>), by putting hte attribute clause before the content, this fixes the error as follows:
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:if test="$currentPage/ancestor-or-self::node/@id=@id">
<xsl:attribute name="class">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="@nodeName"/>
</a>
Similar Posts
- Remember the Enctype for Forms!
- Everything Basecamp To-Do List Templates
- Validating a dropdpwn list in ASP.NET 2.0
