You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2007/10/26 20:24:50 UTC
[jira] Created: (XALANJ-2411) XSLTC creates namespace nodes when it
could re-use existing ones in scope.
XSLTC creates namespace nodes when it could re-use existing ones in scope.
--------------------------------------------------------------------------
Key: XALANJ-2411
URL: https://issues.apache.org/jira/browse/XALANJ-2411
Project: XalanJ2
Issue Type: Bug
Affects Versions: The Latest Development Code, 2.7.1
Reporter: Brian Minchau
Assignee: Brian Minchau
XSLTC creates extra namespace nodes, mapping ns0, ns1 ... to URIs when an existing namespace mapping is
in scope and its prefix could be used (or the default namespace could be used).
Here is a stylesheet showing the problem:
<?xml version="1.0" encoding="UTF-8"?>
<!-- bug.xsl -->
<xsl:stylesheet version="1.0"
xmlns="http://uri1"
xmlns:prfx2='http://uri2'
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<out2>
<xsl:call-template name="makeElement1">
<xsl:with-param name="tagName" select="'elemName1'" />
</xsl:call-template>
<xsl:call-template name="makeElement2">
<xsl:with-param name="tagName" select="'elemName2'" />
</xsl:call-template>
<xsl:call-template name="makeElement3">
<xsl:with-param name="tagName" select="'elemName3'" />
</xsl:call-template>
</out2>
</xsl:template>
<xsl:template name="makeElement1">
<xsl:param name="tagName"/>
<xsl:element name="{$tagName}" namespace='http://uri1'/>
</xsl:template>
<xsl:template name="makeElement2">
<xsl:param name="tagName"/>
<xsl:element name="{$tagName}" namespace='http://uri2'/>
</xsl:template>
<xsl:template name="makeElement3">
<xsl:param name="tagName"/>
<xsl:element name="{$tagName}" namespace='http://uri3'/>
</xsl:template>
</xsl:stylesheet>
When run with any XML input, or this one, bug.xml:
<?xml version="1.0" encoding="UTF-8"?><doc/>
Using say the process command:
java org.apache.xalan.xslt.Process -XSLTC -IN bug.xml -XSL bug.xsl
The output is this:
<?xml version="1.0" encoding="UTF-8"?><out2 xmlns:prfx2="http://uri2" xmlns="http://uri1">
<ns0:elemName1 xmlns:ns0="http://uri1"/>
<ns1:elemName2 xmlns:ns1="http://uri2"/>
<ns2:elemName3 xmlns:ns2="http://uri3"/>
</out2>
The output should be:
<?xml version="1.0" encoding="UTF-8"?><out2 xmlns:prfx2="http://uri2" xmlns="http://uri1">
<elemName1/>
<elemName2 xmlns="http://uri2"/>
<elemName3 xmlns="http://uri3"/>
</out2>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANJ-2411) XSLTC creates namespace nodes when
it could re-use existing ones in scope.
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XALANJ-2411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538110 ]
Brian Minchau commented on XALANJ-2411:
---------------------------------------
In the testcase in the body of this issue I have these remarks:
Template 'makeElement1' makes sure that the default namespace is used
rather than generating ns0 mapping to the same URI and using that.
Template 'makeElement2' also makes sure that ns0, ns1 ... sort of
prefix isn't generated, but also that the convenient prfx2 isn't used,
but rather that the default namespace is changed on this element.
Template 'makeElement3' makes sure that a new prefix is not generated,
and that the default namespace is changed. There is no possible re-use
of an existing prefix, so this differs from makeElement2.
> XSLTC creates namespace nodes when it could re-use existing ones in scope.
> --------------------------------------------------------------------------
>
> Key: XALANJ-2411
> URL: https://issues.apache.org/jira/browse/XALANJ-2411
> Project: XalanJ2
> Issue Type: Bug
> Affects Versions: The Latest Development Code, 2.7.1
> Reporter: Brian Minchau
> Assignee: Brian Minchau
> Attachments: xalanj-2411.patch2.txt
>
>
> XSLTC creates extra namespace nodes, mapping ns0, ns1 ... to URIs when an existing namespace mapping is
> in scope and its prefix could be used (or the default namespace could be used).
> Here is a stylesheet showing the problem:
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- bug.xsl -->
> <xsl:stylesheet version="1.0"
> xmlns="http://uri1"
> xmlns:prfx2='http://uri2'
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes" />
> <xsl:template match="/">
> <out2>
> <xsl:call-template name="makeElement1">
> <xsl:with-param name="tagName" select="'elemName1'" />
> </xsl:call-template>
>
> <xsl:call-template name="makeElement2">
> <xsl:with-param name="tagName" select="'elemName2'" />
> </xsl:call-template>
>
> <xsl:call-template name="makeElement3">
> <xsl:with-param name="tagName" select="'elemName3'" />
> </xsl:call-template>
> </out2>
> </xsl:template>
>
> <xsl:template name="makeElement1">
> <xsl:param name="tagName"/>
> <xsl:element name="{$tagName}" namespace='http://uri1'/>
> </xsl:template>
>
> <xsl:template name="makeElement2">
> <xsl:param name="tagName"/>
> <xsl:element name="{$tagName}" namespace='http://uri2'/>
> </xsl:template>
>
> <xsl:template name="makeElement3">
> <xsl:param name="tagName"/>
> <xsl:element name="{$tagName}" namespace='http://uri3'/>
> </xsl:template>
>
> </xsl:stylesheet>
> When run with any XML input, or this one, bug.xml:
> <?xml version="1.0" encoding="UTF-8"?><doc/>
> Using say the process command:
> java org.apache.xalan.xslt.Process -XSLTC -IN bug.xml -XSL bug.xsl
> The output is this:
> <?xml version="1.0" encoding="UTF-8"?><out2 xmlns:prfx2="http://uri2" xmlns="http://uri1">
> <ns0:elemName1 xmlns:ns0="http://uri1"/>
> <ns1:elemName2 xmlns:ns1="http://uri2"/>
> <ns2:elemName3 xmlns:ns2="http://uri3"/>
> </out2>
> The output should be:
> <?xml version="1.0" encoding="UTF-8"?><out2 xmlns:prfx2="http://uri2" xmlns="http://uri1">
> <elemName1/>
> <elemName2 xmlns="http://uri2"/>
> <elemName3 xmlns="http://uri3"/>
> </out2>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANJ-2411) XSLTC creates namespace nodes when
it could re-use existing ones in scope.
Posted by "Christine Li (JIRA)" <xa...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XALANJ-2411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538121 ]
Christine Li commented on XALANJ-2411:
--------------------------------------
The patch looks good to me.
> XSLTC creates namespace nodes when it could re-use existing ones in scope.
> --------------------------------------------------------------------------
>
> Key: XALANJ-2411
> URL: https://issues.apache.org/jira/browse/XALANJ-2411
> Project: XalanJ2
> Issue Type: Bug
> Affects Versions: The Latest Development Code, 2.7.1
> Reporter: Brian Minchau
> Assignee: Brian Minchau
> Attachments: xalanj-2411.patch2.txt
>
>
> XSLTC creates extra namespace nodes, mapping ns0, ns1 ... to URIs when an existing namespace mapping is
> in scope and its prefix could be used (or the default namespace could be used).
> Here is a stylesheet showing the problem:
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- bug.xsl -->
> <xsl:stylesheet version="1.0"
> xmlns="http://uri1"
> xmlns:prfx2='http://uri2'
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes" />
> <xsl:template match="/">
> <out2>
> <xsl:call-template name="makeElement1">
> <xsl:with-param name="tagName" select="'elemName1'" />
> </xsl:call-template>
>
> <xsl:call-template name="makeElement2">
> <xsl:with-param name="tagName" select="'elemName2'" />
> </xsl:call-template>
>
> <xsl:call-template name="makeElement3">
> <xsl:with-param name="tagName" select="'elemName3'" />
> </xsl:call-template>
> </out2>
> </xsl:template>
>
> <xsl:template name="makeElement1">
> <xsl:param name="tagName"/>
> <xsl:element name="{$tagName}" namespace='http://uri1'/>
> </xsl:template>
>
> <xsl:template name="makeElement2">
> <xsl:param name="tagName"/>
> <xsl:element name="{$tagName}" namespace='http://uri2'/>
> </xsl:template>
>
> <xsl:template name="makeElement3">
> <xsl:param name="tagName"/>
> <xsl:element name="{$tagName}" namespace='http://uri3'/>
> </xsl:template>
>
> </xsl:stylesheet>
> When run with any XML input, or this one, bug.xml:
> <?xml version="1.0" encoding="UTF-8"?><doc/>
> Using say the process command:
> java org.apache.xalan.xslt.Process -XSLTC -IN bug.xml -XSL bug.xsl
> The output is this:
> <?xml version="1.0" encoding="UTF-8"?><out2 xmlns:prfx2="http://uri2" xmlns="http://uri1">
> <ns0:elemName1 xmlns:ns0="http://uri1"/>
> <ns1:elemName2 xmlns:ns1="http://uri2"/>
> <ns2:elemName3 xmlns:ns2="http://uri3"/>
> </out2>
> The output should be:
> <?xml version="1.0" encoding="UTF-8"?><out2 xmlns:prfx2="http://uri2" xmlns="http://uri1">
> <elemName1/>
> <elemName2 xmlns="http://uri2"/>
> <elemName3 xmlns="http://uri3"/>
> </out2>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org