spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / authoring / languages / xml / insidexslt / chap2 / 5 current pageTo page 2To page 3To page 4
[next]

Inside XSLT

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Choosing Output Methods

[Editor's note: the following is a continuation of our series of excerpts from chapter 2 of the New Riders publication, "Inside XSLT."]

Another important aspect of writing stylesheets is picking the output method: XML, HTML, text (that is, any kind of text-based document that is not XML or HTML), and so on. In other words, the output method determines the type of document you're creating. By default, the output method is XML, although most processors create HTML documents if they see a <HTML> element. (Some processors also do this if the extension of the document file you're creating is .html.)

Chapter 6 discusses how this works in depth, but I'll look at this topic in overview now. Unless you are sure that the default output type rules of your XSLT processor are doing what they should, it's often advisable to set the output type explicitly to match the kind of output document you want, using the <xsl:output> element. The output type can determine, for example, whether the XSLT processor writes the XML processing instruction, <?xml version="1.0"?>, at the beginning of the document, and it can determine the MIME type (such as "text/xml" or "text/html") of documents sent back from an XSLT processor on a Web server to a browser. In addition, if you set the output type to HTML, most XSLT processors recognize that not all elements in HTML need closing as well as opening tags, and so on.

Chapter 6 is about converting from XML to other document types, but I'll take a look at <xsl-output> in overview here because it's important to understand when working with stylesheets in general. The following list includes the attributes of <xsl-output>:

The most-used attribute of this element is method, because that's what you use to set the output tree type you want. The three most common settings are "html", "xml", and "text".


home / authoring / languages / xml / insidexslt / chap2 / 5 current pageTo page 2To page 3To page 4
[next]

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business

Created: October 11, 2001
Revised: October 11, 2001


URL: http://webreference.com/authoring/languages/xml/insidexslt/chap2/5/