You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by xa...@xml.apache.org on 2004/10/08 11:11:51 UTC
[jira] Commented: (XALANJ-1942) NPE on sorting using a variable
The following comment has been added to this issue:
Author: Paolo Noya
Created: Fri, 8 Oct 2004 2:10 AM
Body:
Hi Yash, Hi Brian
I tried the patch and all work fine!
Thanks very much for your support.
---------------------------------------------------------------------
View this comment:
http://issues.apache.org/jira/browse/XALANJ-1942?page=comments#action_53834
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/XALANJ-1942
Here is an overview of the issue:
---------------------------------------------------------------------
Key: XALANJ-1942
Summary: NPE on sorting using a variable
Type: Bug
Status: Resolved
Priority: Blocker
Resolution: FIXED
Project: XalanJ2
Components:
Xalan
Fix Fors:
2.6
Versions:
2.6
Assignee:
Reporter: Paolo Noya
Created: Tue, 14 Sep 2004 2:10 AM
Updated: Fri, 8 Oct 2004 2:10 AM
Description:
Similar to issue n. 1577
I've a problem during sort node with xalan-j version 2.6.0 and also with 2.4.1(bundle with jdk 1.4.2_05).
I have an XML like this:
<?xml version="1.0"?>
<Peoples>
<Person>
<Name>Johnson</Name>
<Level>foo</Level>
</Person>
<Person>
<Name>Smith</Name>
<Level>baz</Level>
</Person>
<Person>
<Name>White</Name>
<Level>foo</Level>
</Person>
<Person>
<Name>Brown</Name>
</Person>
<Person>
<Name>Black</Name>
<Level>bar</Level>
</Person>
</Peoples>
=======================
and I want sort by level and then by name giving a rule for
mapping level with an arbitrary number.
I wrote an xml like this:
=======================
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:this="http://localhost/" exclude-result-prefixes="this"
>
<this:Levels>
<Level pos="0"/><!--dummy level-->
<Level pos="1">foo</Level>
<Level pos="2">bar</Level>
<Level pos="3">baz</Level>
</this:Levels>
<xsl:variable name="levels"
select="document('')/xsl:stylesheet/this:Levels"/>
<xsl:template match="/Peoples">
<xsl:apply-templates select="Person">
<xsl:sort data-type="number"
select="number($levels/Level[.=current()/Level]/@pos)"/>
<xsl:sort select="Name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="Person">
<xsl:value-of select="Name"/>
</xsl:template>
</xsl:stylesheet>
=======================
during transfom, the element <xsl:sort data-type="number"
select="number($levels/Level[.=current()/Level]/@pos)"/>
produce an excepiton
javax.xml.transform.TransformerException:
java.lang.NullPointerException
If i print the <xsl:value-of
select="number($levels/Level[.=current()/Level]/@pos)"/> in
"Person" template I got the correct value.
Other parsers give me the correct result.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org