[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Understanding xmlns declaration and encoding

Subject: RE: Understanding xmlns declaration and encoding
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 8 Sep 2004 19:14:55 +0100
xmlns encoding
> When I exclude this
> xmlns="http://www.w3.org/1999/xhtml"
> 
> from the stylesheet decleration, I notice that <br/> tags and 
> <hr/> tags
> end up like this: <br> and <hr>.  Including it results in the 
> <html> tag
> looking like this:
> <HTML xmlns="http://www.w3.org/1999/xhtml">
> 
> and the <br> and <hr> tags are now <br/> and <hr/> in the result.
> 
> Is this all confirmed and normal behaviour?

Yes. The output method defaults to HTML if the outermost element in the
result tree is an <html> element in the null namespace. And whether or not
the output method is HTML, elements in a non-null namespace are serialized
using XML rules, so an empty <br> element in the XHTML namespace is written
as <br/>.
> 
> I guess I don't understand when:
> <xsl:output method="html" encoding="??????????"/>
> The encoding has any effect on the outcome.
> 

The encoding parameter affects the outcome if (a) you are using the XSLT
processor to do the serialization (and not, say, the DOM save method), and
(b) the destination of the output is a byte stream rather than a character
stream. A common mistake for Microsoft users is to serialize to a character
stream, in which case the final encoding is outside the control of the XSLT
processor.

Michael Kay

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.