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

Re: Suppressing xmlns attribute (XSL and JSP)

Subject: Re: Suppressing xmlns attribute (XSL and JSP)
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 27 Feb 2001 09:30:19 +0000
jsp namespace declaration
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:

  &lt;jspview:result>
  &lt;/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


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.