The xsl:output Element

XLST is oriented toward transforming a source tree into a result tree. What, exactly, a processor does with the result tree is not within the scope of the XSLT Recommendation. However, XSLT does give the stylesheet designer a way to request that an XSLT processor creates output with certain characteristics. Such requests are made by using the xsl:output Element. It is optional, and although the Recommendation says that processors should use the information in this Element to produce the output, the Recommendation doesn't require that they do. However, the most commonly used processors do pay attention to the xsl:output Element.

The xsl:output Element has several optional Attributes, but we'll use only a few. The method Attribute allows users to request XML, HTML, text, or their own defined type of output. We'll use "xml" as the value. We'll also use the encoding Attribute to specify an encoding of UTF-8. Some processors produce UTF-16 as the default, but for ASCII-oriented systems (and people) we would generally prefer UTF-8. For readability in pasting example result documents into this book, I also used the indent Attribute with a value of "yes". You might not want to use it in production applications since it generates unneeded whitespace.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset