Xslt Extension Objects- Getting Context
i'm using XsltArgumentList.AddExtension开发者_如何学CObject
with sucess.
The problem is when i call the functions from the xslt, they only get the arguments i pass.
How can i get the context (what node is being processed).
I am using XslTransform.Transform (myXPathDoc, xslArgs, myWriter);
to start the transformation..
I heard about SetContext
and RegisterCustomFunction
but they only seem to work on XPathExpression
objects...
Thanks
There is no documented way for an extension function to implicitly access the context node.
Pass it as a parameter.
For example:
<xsl:value-of select="extFn:MyExtensionFunction(.,'A',./code,./date)"/>
You will need to modify the code of the extension function: add a new parameter, which must be the first in order, and it is via this new parameter that the extension function gets the current node.
精彩评论