xsl:template (priority)

To avoid the source node matching 2 different template rules, some priority rules have been specified.

  • Imported Templates have lower priority compared to locally defined templates.

  • Use the 'priority' attribute to specifically specify the priority.

  • Otherwise, generically speaking, the more specific the XPath, the higher the priority.

    match="test/test[@test='test']" > match="test/test[@test]" > match="test/test" > 
    match="test" > match="*" > match="node()"
  • (low) -N <-> 0 <-> +N (high)

  • An error will be thrown, if the source node still matches 2 different template rules.