XSL xsl:template match=“/”

前端 未结 3 963
小鲜肉
小鲜肉 2020-11-27 09:50

I am just learning XML and how to use XSL files. In an XSL file I found the following term:

xsl:template match=\"/\"

What does this stand f

3条回答
  •  無奈伤痛
    2020-11-27 10:09

    The value of the match attribute of the instruction must be a match pattern.

    Match patterns form a subset of the set of all possible XPath expressions. The first, natural, limitation is that a match pattern must select a set of nodes. There are also other limitations. In particular, reverse axes are not allowed in the location steps (but can be specified within the predicates). Also, no variable or parameter references are allowed in XSLT 1.0, but using these is legal in XSLT 2.x.

    / in XPath denotes the root or document node. In XPath 2.0 (and hence XSLT 2.x) this can also be written as document-node().

    A match pattern can contain the // abbreviation.

    Examples of match patterns:

    
    

    can be applied on any element named table.

    
    

    can be applied on any element named y whose parent is an element named x.

    
    

    can be applied to any element.

    
    

    can be applied only to the top element of an XML document.

    
    

    can be applied to any attribute.

    
    

    can be applied to any text node.

    
    

    can be applied to any comment node.

    
    

    can be applied to any processing instruction node.

    
    

    can be applied to any node: element, text, comment or processing instructon.

提交回复
热议问题