[xsl] Suppressing xmlns attribute (XSL and JSP)

Subject: [xsl] Suppressing xmlns attribute (XSL and JSP)
From: Dale Sedivec <dale@xxxxxxxxxx>
Date: Mon, 26 Feb 2001 14:43:34 -0500
	Greetings!  I'm having a problem with generating JSP that has
references to custom tags from XSL.

	Say I've got the following XSL file:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0" xmlns:jspview="jspview.com"
                exclude-result-prefixes="jspview">
        <xsl:output method="html" />

        <xsl:template match="/">
                <jspview:result>
                </jspview:result>
        </xsl:template>
</xsl:stylesheet>

and the following XML file for input:

<?xml version="1.0" ?>
<doc />

(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.

	The output from these two files from Saxon is as follows:

[darkness@siuan saxon-6]$ CLASSPATH=$CLASSPATH:./saxon.jar java
com.icl.saxon.StyleSheet test2.xml test2.xsl
<jspview:result xmlns:jspview="jspview.com"></jspview:result>

	The problem comes in because JSP doesn't like it when I
include some unknown attribute (xmlns:jspview) for my custom tag,
since it's not declared that way.

	I could kludge around this by making some initial tag that JSP
thinks takes an attribute named xmlns:jspview, and then it would
(theoretically) be declared for the remainer of the document.
However... this is really ugly, IMO.

	Is there any way to suppress the output of that namespace
declaration (xmlns:jspview="jspview.com")?  I've read people saying it
isn't possible, but certainly someone is using custom tags generated
from XSL (without declaring an xmlns attribute for each tag in your
tag library -- really ugly).

TIA for any help,
darky
-- 

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


Current Thread