Create Custom XSLT Functions using .NET XSLT Processor

It is possible to create custom functions using .NET 4.5 XSLT processor ?

All I could do is to create templates and call them by sending parameters.

There is a work-around or something ? or should I simple go to 2.0 ?

Something like this:

<xsl:function name="name">
... my function
</xsl:function>

Thanks!

Upvotes: 1

Views: 405

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1063864

xsl:function is a xsl 2.0 feature. The inbuilt .NET xsl processing is not 2.0 (it is W3C XSL Transformations (XSLT) Version 1.0 Recommendation).

You can use script blocks (via XsltSettings.EnableScript), and you can use methods exposed on external objects (via XsltArgumentList.AddExtensionObject). Or you can use a different (2.0) xslt processor; maybe Saxon.

Upvotes: 1

Related Questions