Error message in XSLT with C# extension function

前端 未结 2 531
故里飘歌
故里飘歌 2021-01-13 02:41

I am received the following error while trying to implement a C# extension function in XSLT.

Extension function parameters or return values which have

2条回答
  •  一生所求
    2021-01-13 03:25

    XSLT extension methods must return a type that is supported within XSL transformations. The following table shows the W3C XPath types and their corresponging .NET type:

    W3C XPath Type        | Equivalent .NET Class (Type)
    ------------------------------------------------------
    String                | System.String
    Boolean               | System.Boolean
    Number                | System.Double
    Result Tree Fragment  | System.Xml.XPath.XPathNavigator
    Node Set              | System.Xml.XPath.XPathNodeIterator
    

    The table is taken from the section Mapping Types between XSLT and .NET in this MSDN Magazine article.

    Instead of returning a string[] array you would have to return an XPathNodeIterator like it is done in the following example:

    
    
    
    

    In your XSL transform you can then iterate over the elements in the returned node set using xsl:for-each:

    
        
            
                
                    
                
            
        
    
    

提交回复
热议问题