Variable in xsl:template matching pattern

后端 未结 1 1774
情书的邮戳
情书的邮戳 2020-12-10 06:42

Given

An XSLT stylesheet with a global variable:




        
相关标签:
1条回答
  • 2020-12-10 07:23

    Variables are not allowed to be used in match expressions in XSLT 1.0.

    From the XSLT 1.0 specification: Defining Template Rules

    It is an error for the value of the match attribute to contain a VariableReference.

    Variables are allowed in match expressions in XSLT 2.0.

    From the XSLT 2.0 specification: Syntax of Patterns

    Patterns may start with an id FO or key function call, provided that the value to be matched is supplied as either a literal or a reference to a variable or parameter, and the key name (in the case of the key function) is supplied as a string literal. These patterns will never match a node in a tree whose root is not a document node.

    0 讨论(0)
提交回复
热议问题