Difference between * and node() in XSLT

matching, templates, xslt

Solution

<xsl:template match="node()">

is an abbreviation for:

<xsl:template match="child::node()">

This matches any node type that can be selected via `the child::` axis:

element

text-node

processing-instruction (PI) node

comment node.

On the other side:

<xsl:template match="*">

is an abbreviation for:

<xsl:template match="child::*">

This matches any element.

The XPath expression: someAxis::* matches any node of the primary node-type for the given axis.

For the `child::` axis the primary node-type is element.

Problem

What's the difference between these two templates? ``` <xsl:template match="node()"> <xsl:template match="*"> ```

Original source

Related problems