Chapter 3. Controlling Output

Chapter 3 shows you how to control the XML, HTML, and text output of an XSLT processor using the XSLT top-level element output. You have seen the output element in previous examples, but I have only discussed 2 of output's 10 attributes so far. I'll talk about each of output's attributes in this chapter.

In this chapter, I'll talk about the results you can expect from different output methods in XML, HTML, text, or custom output. I'll also cover indentation, how to manage XML declarations, document type declarations, CDATA sections, and media types. For more detail, cross-reference this chapter with Section 16 of the XSLT specification.

Be aware that not all XSLT processors adhere strictly to the output element. There are models in which the XSLT processor has no control over the final serialization of the output because the output values are overridden. You will see an example of this type of model when you use the Moxie processor, discussed in Chapter 17.


Multiple Output Elements

You can use multiple instances of the output element in a stylesheet. If there is more than one occurrence, all the attributes of the output elements are combined when the stylesheet is processed, as if there were only one instance of output. If any of the attributes conflict for example, there were more than one method attribute, each with a different value the value that is in the last occurrence of the attribute wins. This holds true unless other stylesheets are imported into your current stylesheet. XSLT has a mechanism for importing other stylesheets and then assigning priorities for the imported stylesheets. Don't worry about that now. I'll discuss what happens when you import documents in Chapter 13.




Learning XSLT
Learning XSLT
ISBN: 0596003277
EAN: 2147483647
Year: 2003
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net