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

Re: Random Namespaces Declared with XSLT Stylesheet...

Subject: Re: Random Namespaces Declared with XSLT Stylesheet... why?
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 19 Jun 2003 09:51:52 -0600 (MDT)
random stylesheet
Jimmy Cerra wrote:
> I've been hacking a quick-and-dirty transform for turning a custom
> language [1] into HTML (for presentation), but I've got some odd
> behavior.  The stylesheet seems to randomly put namespace declarations
> where they're not needed.  Why is it doing this?

Namespace nodes corresponding to in-scope namespaces are attached to literal
result elements in your stylesheet. These nodes are copied to the result tree
along with the elements. 

When the processor serializes the result tree, it typically does so as soon as
it can -- i.e., it writes out a start tag for an element node before it has
generated all of that node's descendants. In this situation, the processor
can't predict what namespace declarations will be needed by the descendants,
so to be safe, it immediately generates in the start tag whatever namespace
declarations are necessary to reflect changes in the bindings that are in
scope.

One might argue that even if the serialization is done after the result tree
is complete, any "unused" namespace nodes should still be serialized, just by
virtue of their presence in the result tree, because their presence may be
deliberate and may affect further processing of that tree.

You should investigate the use of xsl:element and xsl:attribute to create
elements and attributes that don't inherit namespace nodes from the
stylesheet. You may also rely on exclude-result-prefixes="foo bar baz" on the
xsl:stylesheet or xsl:transform element to dissuade the processor from
serializing declarations for the namespaces bound to those prefixes in the
stylesheet.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.