You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/11/04 12:58:43 UTC
DO NOT REPLY [Bug 14222] New: -
xsl:for-each loop generates wrong namespace declarations
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14222>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14222
xsl:for-each loop generates wrong namespace declarations
Summary: xsl:for-each loop generates wrong namespace declarations
Product: XalanJ2
Version: 2.4
Platform: Other
OS/Version: Other
Status: NEW
Severity: Major
Priority: Other
Component: org.apache.xalan
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: mex02@erv.de
As the following example shows, xalan produces different output
depending on how the inner element of the for-each is declared.
If the namespace is evaluated by a "curlybracket-expression"
an unnecessary (and wrong) null namespace is generated.
Example.xml:
<?xml version="1.0"?>
<root>
<myNameSpace>http://test.dynamic.url</myNameSpace>
<list>
<listelem>one</listelem>
<listelem>two</listelem>
</list>
</root>
Example.xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:element name="newRoot" namespace="{normalize-space(root/myNameSpace)}">
<xsl:element name="elementOk"
namespace="{normalize-space(root/myNameSpace)}">foo</xsl:element>
<xsl:for-each select="root/list/listelem">
<xsl:element name="elementError"
namespace="{normalize-space(root/myNameSpace)}">bar</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:element name="newRoot" namespace="{normalize-space(root/myNameSpace)}">
<xsl:element name="elementOk"
namespace="{normalize-space(root/myNameSpace)}">foo</xsl:element>
<xsl:for-each select="root/list/listelem">
<xsl:element name="hardCodedUrl"
namespace="http://test.dynamic.url">bar</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="UTF-8"?>
<newRoot xmlns="http://test.dynamic.url">
<elementOk>foo</elementOk>
<elementError xmlns="">bar</elementError>
<elementError xmlns="">bar</elementError>
</newRoot>
<newRoot xmlns="http://test.dynamic.url">
<elementOk>foo</elementOk>
<hardCodedUrl>bar</hardCodedUrl>
<hardCodedUrl>bar</hardCodedUrl>
</newRoot>