- or if you need to set or override an attribute only when a certain condition is met:
<li>
<!-- Only add class on uneven nodes -->
<xsl:if test="position() mod 2 = 1">
<xsl:attribute name="class">odd</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<!-- Override the href on the Home node -->
<xsl:if test="self::Home">
<xsl:attribute name="href">/</xsl:attribute>
</xsl:if>
</a>
</li>
Populate form value with nodeName
Hi,
What is the correct way to populate the "value" of a hidden form field with the current Node name?
Thanks!
Amir
Hi Amir,
That's actually close to Razor syntax :-)
No, seriously, you just need to wrap a couple of curlies around it:
If you're inside the root template (match="/") you'll need $currentPage as well:
/Chriztian
Thank you Chriztian!
I also found that you can do it this way:
You're absolutely right - though it's clunkier, it has its use when you don't know the name of the attribute you're creating, e.g.:
- or if you need to set or override an attribute only when a certain condition is met:
/Chriztian
is working on a reply...