开发者

How does umbraco mix XSLT with C# code

开发者 https://www.devze.com 2023-02-27 02:28 出处:网络
Take a look at this code: <ul> <xsl:for-each select=\"$currentPage/node\"> <li><a>

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

0

精彩评论

暂无评论...
验证码 换一张
取 消