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

Can one _generate_ namespace nodes?

Subject: Can one _generate_ namespace nodes?
From: Joseph Kesselman <keshlam@xxxxxxxxxx>
Date: Fri, 21 Feb 2003 19:24:08 -0500
 Can one _generate_ namespace nodes?
I've got a situation where I'm using namespace aliasing. It's working 
fine, but the output (using Xalan, at least) is a bit ugly; the serializer 
doesn't realize that the new prefix binding is required until it gets down 
to the aliased nodes, and generates the binding there. Since these are 
scattered throughout the document, that means a lot of namespace 
declaration nodes.

I'd prefer to declare the new prefix once, at the top of the generated 
document. But there doesn't seem to be a way to express that. There's no 
<xsl:namespace-node> to go with <xsl:attribute>, and <xsl:attribute> is 
explicitly forbidden to generate namespace declarations. (Actually, the 
way it's forbidden doesn't work now that namespaces have been redefined to 
be namespace-aware rather than being hardcoded to the xmlns: prefix, but 
that's a separate matter.)

I could generate a dummy attribute with the correct prefix and namespace 
at the top level, and let that imply a declaration -- but that could break 
validation of the generated document, and sometimes it's explicitly 
forbidden. (If I'm generating a stylesheet element, I'd have to create an 
attribute in the same namespace as xsl: -- but those are reserved for 
XSL's use, and there isn't one which is officially legal on an 
<xsl:stylesheet> element.)


I say again, this is an attempt to fix a purely cosmetic problem... but it 
really feels like there ought to be a solution. If anyone *does* know of 
an official and reliable way to generate a namespace declaration into a 
document at a specific point, I'd appreciate the tip!

If not... well, the article goes out as "it's ugly but it works."

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies:
XML, XSL and more.  "may'ron DaroQbe'chugh vaj bIrIQbej" 
("Put down the squeezebox and nobody gets hurt.")

 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.