[xsl] stylesheets without match="*" templates

Subject: [xsl] stylesheets without match="*" templates
From: Garvin Riensche <g.riensche@xxxxxxx>
Date: Wed, 12 Nov 2008 12:49:58 +0100

I am working an a translator for xslt into a certain prolog implementation.
In the implementation it makes a big difference if you want to translate a stylesheet which contains a template like:

<xsl:template match="*">

or not.

If such a template is used, the structure of the result sequence will be similar to the input structure and it is sure that the outpult will be valid XML as there is only one root node (if the input is valid xml).

If such a template is missing, all templates that are not called by an explicit apply-templates will put their first nodes as root nodes. So the result would be like


I think this is not wanted in most cases.

Without going into detail, it's difficult for me to put these nodes into the right order, because their order can't be deduced from the templates.

My question to you is: In practise, how many stylessheets of the second type without a template like the one above exist? My assumption is, that most stylesheets contain such a template, to keep the structure and to secure to get valid XML. If that is true I won't consider stylesheets without template like above in my implementation.

I should say, that I am only interested in Stylesheets that transform data. So stylesheets that compute anything like "Knight's tour" are not on my focus.


Current Thread