[xslt] Namespace bug with imported stylesheet
- From: Brent Hendricks <brentmh ece rice edu>
- To: xslt <xslt gnome org>
- Subject: [xslt] Namespace bug with imported stylesheet
- Date: Mon, 15 Apr 2002 11:42:44 -0500
I've stumbled across a rather obscure namespace bug. It only occurs
when I have two namespaces in a stylesheet (with one specifed as the
default) and I include a second stylesheet with the same namespaces
declared, but the other one declared as the default (and also with an
explict prefix). It's hard to describe in words. Easier if you take a
look at the attached files.
Using the attached stylesheet mainstyle.xsl against in.xml should yield:
<a:document xmlns:a="namespace:a">
<b:result xmlns:b="namespace:b"/>
</a:document>
or something equivalent. But instead, xsltproc outputs:
<a:document xmlns:a="namespace:a" xmlns="namespace:b">
<result xmlns:b="namespace:b" xmlns="namespace:a"/>
</a:document>
Note that here <result> is incorrectly in namespace:a
-- Brent
-------------------------------------------------------------------------
"The programmer, like the poet, works only slightly removed from pure
thought-stuff. He builds his castles in the air, from air, creating
by exertion of the imagination. Few media of creation are so
flexible, so easy to polish and rework, so readily capable of
realizing grand conceptual structures."
-- Frederick Brooks, Jr., The Mythical Man Month
<document xmlns="namespace:a">
<apply />
</document>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="namespace:a"
xmlns:b="namespace:b"
xmlns="namespace:a">
<xsl:template match="a:apply">
<b:result />
</xsl:template>
</xsl:stylesheet>
<?xml version= "1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="namespace:a"
xmlns="namespace:b">
<xsl:include href="include.xsl"/>
<xsl:template match="a:document">
<a:document>
<xsl:apply-templates/>
</a:document>
</xsl:template>
</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]