[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Suppressing xmlns attribute (XSL and JSP)
Hi Dale, > (Yes, it is just that short for this example. :) ) jspview is a a > custom tag library that my servlet container knows about. However, > there is no declaration in the document for the namespace (it's done > from the <%@ taglib uri="..." prefix="..." %> element) in the source > document. So the document that you want to produce is: <%@ taglib uri="..." prefix="..." %> <jspview:result> </jspview:result> Right? As far as XSLT is concerned, that's not an XML document. Even if you take out the weird first line, the element uses an undeclared prefix. There's no way for XSLT to generate a node tree that contains an element that has a qualified name for which there is no namespace node. And if it can't create a node tree for a document, then it can't give you the document. So the only way around it is to produce the thing as text. It's pretty horrific. Rather than: <jspview:result> </jspview:result> you have to use: <![CDATA[ <jspview:result> </jspview:result> ]]> or: <jspview:result> </jspview:result> and set your output to text with: <xsl:output method="text" /> It means you can't use all the wonderful element and attribute-creating stuff that XSLT gives you. And it'll make your stylesheet really messy too. I don't know whether you can do this, but you could get around it if you could create a document that was: <%@ taglib uri="..." prefix="..." %> <result> </result> As far as the XSLT is concerned, the 'result' element here is in the null namespace - if you don't put a jspview namespace declaration in the stylesheet, you can produce the above as normal. That would be the cleanest option if it's possible for you to declare default (i.e. unprefixed) namespaces with the taglib 'element'. If not, in your position, I'd be tempted to either change your DTD to include the namespace declaration, or to post-process the file to remove the undesirable namespace declaration. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|