Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
In a previous version of the stylesheet some of these parameters were declared using the syntax.
It's good to see that this has been fixed. Placing the value in the content of the element means that the value is not a simple number or string, but rather a temporary tree, which however much the XSLT processor optimizes it is likely to be a much more heavyweight data structure. The use of
0
and
1
as parameter values, rather than the more obvious
true()
and
false()
, can be justified by the fact that with many XSLT processors, there is no way of supplying boolean parameter values from the command line.
There are two ways these parameters can be set. Either the values can be supplied from the calling application (typically, from the command line) or the parameters can be overridden in an overlay stylesheet. An overlay stylesheet (we'll see examples later) is a stylesheet that imports the main
xmlspec.xsl
stylesheet and makes modifications or extensions to it. If the parameters were designed to be set in this way only, they could have been defined using
The stylesheet uses two key definitions. These are designed to make hyperlinks within the document easier to follow. The first key matches any attribute named
id
, on any element, making it easy to find an element with a given
id
attribute. The DTD allows an
id
attribute on any element whatsoever. In fact, it defines the type of the attribute to be
ID
, so these elements could also be located using the
id()
function. (Sorry for the overloading of this term!) In fact, the stylesheet avoids the use of the
id()
function altogether, probably because
id()
isn't guaranteed to work correctly unless the document is processed using a validating parser.
The second key definition is a little surprising. A