Share this Page URL

Chapter 10. XML > <xsl:param> - Pg. 167

<xsl:apply-imports> number is the section number in our previous example. any tells the processor to add numbering without regard to level. Here, the numbers of the sections and para- graphs are consecutive. The format attribute indicates the style of numbering. Letters or numbers may be used, with a separator in between. The letters may be A or a (for alphabetical num- bering in upper- or lowercase), I or i (for numbering in upper- or lowercase Roman numerals), or 1 (for numbering in Arabic numerals). For example, to number sec- tions with Roman numerals and paragraphs with lowercase letters, use this format attribute: format="I.a" XML Output Method An XSLT processor can be instructed to produce a specific type of output with the <xsl:output/> element. For example, <xsl:output method="html"/> causes the pro- cessor to execute certain transformations needed for the resulting document to be valid HTML. Specifically, it transforms empty tags. For example, the XML <hr/> tag is converted to the HTML <hr> tag (for horizontal rules) without a closing slash. It is also possible to indicate an XML output method ( method="xml" ), where the XSLT processor adds the standard XML header ( <?xml version="1.0"?> ). It may seem strange to produce an XML document from another XML document, yet it is often helpful to convert a document from one DTD to a valid document for another DTD. Thus, XSLT is also a language for inter-DTD conversions. Finally, you can specify a text output method ( method="text" ) to produce pure text. XSLT has built-in outputs for XML, HTML, and text, but some processors may support other output methods (sometimes identified by URLs). We should point out that when you choose the HTML or XML output method, the processor may remove or rearrange whitespace in blocks of text (spaces, tabs, and carriage returns). However, there are several solutions for preserving whitespace. The first is to indicate the list of elements to be preserved in the <xsl:preserve-space elements=" list "> element. The second is to add the &indent="no"; attribute to the <xsl:output> element to indicate that you do not want the resulting document to be indented. Note, however, that spaces are no longer preserved in <xsl:text> elements where content is written as-is in the resulting document. No indenting is produced for the text output method. XSLT Elements The following list is an enumeration of XSLT elements. <xsl:apply-imports> Chapter 10:XML | 167