Re: [xslt] xsltproc bug or feature?



Hi,

Christian Bucher wrote:

> Hi,
> 
> If I run the command
> 
> xsltproc expand.xsl input.xml
> 
> the following output is produced
> 
> <?xml version="1.0"?>
> <result>
>         <profile><lala xmlns:saxon="http://icl.com/saxon"/></profile>
> </result>
> 
> xsltproc is adding the namespaces used in the style sheet to the first node I define.
> Could somebody tell me if that is a bug in xsltproc.


No, this is compliant with the XSLT rec.

The idea is that, since some vocabularies are also using namespaces 
declarations to qualify "QNames" in attributes (or elements), a XSLT 
processor shouldn't take the responsability to remove any namespace 
declaration.

The author of a stylesheet can do so by using the 
"exclude-result-prefixes" attribute of the stylesheet element:

http://www.w3.org/TR/xslt#stylesheet-element

In you case, <xsl:stylesheet ... exclude-result-prefixes="saxon"> should do the trick.


Hope this helps.

Eric


> 
> thanks
> 
> christian
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0"?>
> <result>
> 	<profile>
> 	</profile>
> </result>
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0"?>
> 
> <xsl:stylesheet version="1.0"
> 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> 	xmlns:saxon="http://icl.com/saxon"; extension-element-prefixes="saxon"
> 
> 
> <xsl:template match="/">
> 	<xsl:apply-templates />
> </xsl:template>
> 
> <xsl:template match="*">
> 	<xsl:copy>
> 		<xsl:apply-templates />
> 	</xsl:copy>
> </xsl:template>
> 
> <xsl:template match="profile">
> 	<xsl:copy>
> 		<lala />
> 	</xsl:copy>
> </xsl:template>
> 
> </xsl:stylesheet>
> 



-- 
Rendez-vous à Paris pour le Forum XML.
                    http://www.technoforum.fr/Pages/forumXML01/index.html
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]