I have a XSLT stylesheet in which I am transforming xml to jsp (from a VB
program). For simplicity, think of it as xml to html. We have some
specific custom jsp tags that have namespaces. For example, we have a
<xxx:textbox> control where xxx is the namespace.
XSLT forces me to define that namespace in the xsl:stylesheet tag or it will
not do the transformation. However, that xmlns:xxx="whatever" namespace
declaration is automatically carried forward in my transformed output and
stuffed into the outermost tag. This causes problems for the J2EE stuff on
the receiving end. I need to define the xmls:xxx in the xsl:stylesheet tag
but do not want it sent along anywhere in the transformed output.
I tried the exclude-result-prefixes attribute, but this only removed it from
the outermost tag and placed it whereever the namespace was actually used.
This is no go, also. I need it completely suppressed.
Any help greatly appreciated.
Brian
How are you producing the elements in the output?
If you are using <xsl:copy> or <xsl:copy-of> then you cannot supress the
namespace where there is one bound on the source document elements. This is
because the XSLT <xsl:copy> and <xsl:copy-of> are exactly that - a direct
copy (namespace and all). If this is what is causing the problem you will
have to use <xsl:element> and <xsl:attribute>, e.g.
If you had something like...
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="xx"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xx="xxxxx">
<xsl:template match="xx:root | xx:item">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
You would need to instead do...
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="xx"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xx="xxxxx">
<xsl:template match="xx:root | xx:item">
<xsl:element name="{local-name()}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Hope this helps
Marrow, Microsoft XML MVP
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator
"Brian Service" <brian_...@siemens.com.nospam> wrote in message
news:#c7mT4UnCHA.2192@TK2MSFTNGP08...