Chapter 14. Alternative Stylesheets

Up to this point, the XSLT stylesheets you've seen have had the stylesheet element as their document element and have been separate documents from the source documents. This chapter will show you several alternatives to this model.

The first alternative is called a literal result element stylesheet. (I'll sometimes call it a literal stylesheet in this book, just to be brief.) This simplified stylesheet (as XSLT 2.0 calls it), in essence, has a literal result element as its document element rather than stylesheet. You can read more about this kind of stylesheet in Section 2.3 of the XSLT specification.

The second alternative is called an embedded stylesheet, which embeds an XSLT stylesheet in the same document that it transforms. It's a sort of self-contained source and stylesheet combined. This requires the use of the id attribute on the stylesheet element. See Section 2.7 of the XSLT specification for more information on embedded stylesheets.

In addition, this chapter will discuss the namespace-alias element. This element allows you to swap a namespace aliased in a stylesheet with a different one in the result. You'll also see how to exclude unneeded namespaces with the exclude-result-prefixes attribute.

The opening example shows you how to use a literal stylesheet.



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