Take a look at this code:
<ul>
<xsl:for-each select="$currentPage/node">
<li><a>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl(current()/@id)"/>
</xsl:attribute>
<xsl:value-of select="current()/@nodeN开发者_运维百科ame"/>
</a>
</li>
</xsl:for-each>
</ul>
As you can see there are umbraco commands within the xslt. How exactly is this done? How can I put my own C# commands in my xslt?
Create a class with public static methods. Then register your assembly in the XsltExtensions.config file in the config directory.
There is example configuration in the file.
There are a number of approaches for injecting some custom logic. Check it out - http://msdn.microsoft.com/en-us/magazine/cc302079.aspx
精彩评论