[ http://issues.apache.org/jira/browse/XALANJ-1942?page=all ]
Brian Minchau updated XALANJ-1942: ---------------------------------- Fix Version: 2.7 (was: 2.6) > NPE on sorting using a variable > ------------------------------- > > Key: XALANJ-1942 > URL: http://issues.apache.org/jira/browse/XALANJ-1942 > Project: XalanJ2 > Type: Bug > Components: Xalan > Versions: 2.6 > Reporter: Paolo Noya > Priority: Blocker > Fix For: 2.7 > Attachments: Patch.txt, patch.1942.txt > > 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. -- 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]