Dec 19, 2008

XSLT note 1 - built-in template

A simple xslt is a empty xslt.


But it does something, it actually is equivalent to the following style sheet. Those template are built-in and can not be removed.




Let's take a look what is the function of the template. The first template apply all the nodes match "* | /" with this template. * is any node, "/" is root node. The element first selects a set of nodes using the expression specified in the select attribute. If this attribute is left unspecified, which here is this case, all children of the current node are selected. For each of the selected nodes, directs the XSLT processor to find an appropriate to apply. Templates are tested for applicability by comparing the node to the XPath expression specified in the template's match attribute. If more than one template satisfies the match pattern, the one appearing with the highest priority is chosen. If several templates have the same priority, the last in the style sheet is chosen.

It seems that is same as , but it is not. It is same as . If we want attribute is included we should use . This template basically output all the value of element nodes.