Browse DevX
Sign up for e-mail newsletters from DevX


Document Your XSLT-4 : Page 4




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Describing Output
Taken together the summary and the public descriptions can provide a detailed user interface. However, as I mentioned previously, the structure of the XSLT document itself can also provide a great deal of information about what it is supposed to do. One of the most useful of these nodes is the <?XML:NAMESPACE PREFIX = XSL /><XSL:OUTPUT>node, which contains a number of attributes that are key to understanding what comes from the transformation.

The documentation stylesheet queries the <XSL:OUTPUT> node if it exists, giving the explicit values of attributes or their defaults if none are provided, as follows:


  • Method:xml
  • Media-Type:text/html
  • Indent: No (default)
  • Version:1.0 (default)
  • XML Declaration Omitted:yes
  • Stand Alone: Either
  • Encoding: UTF-16
  • Is Identity Template:no
  • Is Stylesheet Executable:yes

The last two elements need to be explained in a little more detail. One template pattern that commonly crops up is the identity template. Such a template is also known as a treewalker, since it works by walking over each node and copying it to the output stream unless there is a specific template that overrides the default match. Identity templates are useful for expanding custom tags in XHTML elements and can change the behavior of the code considerably. The item Is Identity Template will be set to yes either if the pattern for an identity exists (e.g., "*|@*|text()" or "@*|node()") or if a <XSL:IMPORT href="identity.xsl"></XSL:IMPORT>or <XSL:INCLUDE href="identity.xsl"></XSL:INCLUDE>tag is in the body of the script. Note that if a subordinate imported or included template references an identity.xsl tag but the current document does not, then this property will be set to "no".

Is Stylesheet Executable catches the other primary type of stylesheets. If a template matches the root node (i.e., <XSL:TEMPLATE match="/"></XSL:TEMPLATE>then when it is applied to an XML document it will convert the document. However, without that root match, there is nothing to "start" the process, and the stylesheet won't work. In some cases, such as libraries of specialized templates, there is no real reason to include a root node template, because these stylesheets are meant to be called only through the <XSL:CALL-TEMPLATE>interface. If a root match exists, then this stylesheet is considered executable (hence, Is Stylesheet Executable is set to "yes") while if the root match doesn't exist, this property will be "no". Again, the documentation does not check to see if imported documents contain executable code.

Finally, note that if the document contains more than one <XSL:OUTPUT>node, the output nodes will be combined together into a single output block. When conflicts occur between attribute values in multiple output nodes, the documentation will use the value that appears last in the document. </XSL:OUTPUT>


Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date