NPE when using xsl:sort that contains xmlns:xsl
-----------------------------------------------
Key: XALANJ-2460
URL: https://issues.apache.org/jira/browse/XALANJ-2460
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone (Ordinary problems in
Xalan projects. Anybody can view the issue.)
Components: transformation
Affects Versions: 2.7.1
Reporter: Thorsten Scherler
I have a weird problem with xsl:sort, as soon as I use it within an
apply-templates tag xalan will throw a npe if the xsl:sort element contains
xmlns:xsl.
Input:
sort.xml
*********
<root>
<child prioridad="2">
2
</child>
<child prioridad="3">
3
</child>
<child prioridad="1">
1
</child>
<child prioridad="5">
5
</child>
<child prioridad="4">
4
</child>
</root>
-----------------
XSL that will show the bug:
1) sort.xsl
*********
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
match="/">
<forrest:content
xmlns:forrest="http://apache.org/forrest/templates/1.0">
<forrest:part
xmlns:forrest="http://apache.org/forrest/templates/1.0">
<xsl:apply-templates
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
</forrest:part>
</forrest:content>
</xsl:template>
<xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
match="root">
<xsl:apply-templates
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" select="child">
<xsl:sort xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
select="@prioridad" data-type="number" />
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
-----------------
Same xsl but removed the superfluous ns declaration:
2) sort.xsl
**********************************************************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<forrest:content
xmlns:forrest="http://apache.org/forrest/templates/1.0">
<forrest:part>
<xsl:apply-templates />
</forrest:part>
</forrest:content>
</xsl:template>
<xsl:template match="root">
<xsl:apply-templates select="child">
<xsl:sort select="@prioridad" data-type="number" />
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
-----------------
The 1) one will throw an error (will attach it in a separate comment) the 2) is
working just fine.
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]