You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Thorsten Scherler (JIRA)" <xa...@xml.apache.org> on 2008/10/17 14:31:44 UTC

[jira] Commented: (XALANJ-2460) NPE when using xsl:sort that contains xmlns:xsl

    [ https://issues.apache.org/jira/browse/XALANJ-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640508#action_12640508 ] 

Thorsten Scherler commented on XALANJ-2460:
-------------------------------------------

java code:
TransformerFactory transFact = TransformerFactory.newInstance();
transformer = transFact.newTransformer(xslSource);

> 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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org