| home / experts / xml / column17 |
|
|
The xsl:output element allows stylesheet authors to specify how they wish the result tree to be output. Currently three output methods are defined: xml, html and text. The xml output method outputs the result tree as a well-formed XML entity.
The html output method takes care of some specialties of HTML documents, for instance omitting end-tags for empty elements. For example, an element written as <br/> or <br></br> in the stylesheet should be output as <br>.
HTML elements should be recognized regardless of case; for example, elements named br, BR or Br should all be recognized as the HTML br element and output without an end-tag. No escaping for the content of the script and style elements should be performed.
The text output method outputs the result tree by writing the string-value of every text node in the result tree in document order without any escaping. The media-type attribute is applicable, the default being text/plain.
The encoding attribute identifies the encoding that the text output method should use to convert sequences of characters to sequences of bytes. The default is system-dependent.
For source documents, the set of whitespace-preserving element names is specified by xsl:strip-space and xsl:preserve-space top-level elements. These elements each have an elements attribute whose value is a whitespace-separated list of name tests, which are expressed in XPath (see below).
The xsl:decimal-format element declares a decimal-format, which controls the interpretation of a format pattern used by the format-number function. If there is a name attribute, then the element declares a named decimal-format; otherwise, it declares the default decimal-format.
For formatting a number the following attributes are used, with their respective default values in brackets: decimal-separator (.), grouping-separator (e.g. thousands) (,), percent (%), per-mille (#x2030), zero-digit (0), a digit in the format pattern (#), pattern-separator (;), infinity (Infinity), NaN (NaN) for Not-A-Number, minus-sign (-, #x2D)
A key is attached to a node and has a name and a value. Thus, a key is a kind of generalized ID, which is not subject to the same limitations as an XML ID. Keys are declared in the stylesheet using xsl:key elements. A key has a name as well as a value; each key name may be thought of as distinguishing a separate, independent space of identifiers. The value of a named key for an element may be specified in any convenient place; for example, in an attribute, in a child element or in content. An XPath expression (below) is used to specify where to find the value for a particular named key. The value of a key can be an arbitrary string; it is not constrained to be a name. There can be multiple keys in a document with the same node, same key name, but different key values. There can also be multiple keys in a document with the same key name, same key value, but different nodes. The key function does for keys what the id function does for IDs.
Next areattribute sets, variables, parameters, and XPath.
Produced by Michael Claßen
All Rights Reserved. Legal Notices.
URL: http://www.webreference.com/xml/column17/2.html
Created: Aug 13, 2000
Revised: Aug 13, 2000