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

Vaclav Bartacek commented on XALANJ-2448:
-----------------------------------------

It is not a bug in XALAN as I realized today.
More precisely - according to the specification the bug is in the XSLT 
implementation used by JDK.
Thanks.

> Invalid XPath evaulation - got list of nodes instead of 1 node
> --------------------------------------------------------------
>
>                 Key: XALANJ-2448
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2448
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in 
> Xalan projects.  Anybody can view the issue.) 
>    Affects Versions: 2.7.1, 2.7, 2.6, 2.5, 2.5Dx, 2.4, 2.4Dx, 2.3, 2.3Dx, 
> 2.2.x, 2.2.0, 2.1.0, 2.0.4, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 2.0.x
>         Environment: Linux 2.6.23.9-mactel. Java 1.6.0_03 or 1.5.0_15
>            Reporter: Vaclav Bartacek
>
> Different results between XALAN and the default Java XLST processor.
> The difference is printed in <xsl:message>COUNT=.....
> The COUNT should be "1", but is actually "4".
> And also the result files out-xalan.xml and out-default.xml differ.
> I suspect problems with recursion.
> -------------------------------------------------------------
> style.xsl:
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet
>  version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>  xmlns:wf="http://www.emeldi.com/tboss/hot-deploy/workflow";
>  >
>  <xsl:output
>   method="xml"
>   indent="yes"
>   omit-xml-declaration="no"
>   encoding="utf-8"/>
>  <xsl:template match="wf:flow">
>   <wf:flow>
>    <xsl:call-template name="steps">
>     <xsl:with-param name="compnum" select="'1'"/>
>     <xsl:with-param name="stepindex" select="'1'"/>
>     <xsl:with-param name="yoffset" select="'0'"/>
>     <xsl:with-param name="maxyoffset" select="'0'"/>
>    </xsl:call-template>
>   </wf:flow>
>  </xsl:template>
>  <xsl:template name="steps">
>   <xsl:param name="compnum"/>
>   <xsl:param name="stepindex"/>
>   <xsl:param name="yoffset"/>
>   <xsl:param name="maxyoffset"/>
>   <xsl:variable name="comp" select="/wf:flow/wf:components/wf:[EMAIL 
> PROTECTED]"/>
>   <xsl:choose>
>    <xsl:when test="$comp">
>     <xsl:variable name="stepname" select="$comp/wf:step-name[$stepindex]"/>
>     <xsl:choose>
>      <xsl:when test="$stepname">
>       <xsl:if test="$stepname='Start'">
>        <xsl:message>
>         COUNT=<xsl:value-of select="count(/wf:flow/wf:[EMAIL PROTECTED])"/>
>        </xsl:message>
>       </xsl:if>
>       <xsl:for-each select="/wf:flow/wf:[EMAIL PROTECTED]">
>        <xsl:call-template name="step">
>         <xsl:with-param name="compnum" select="$compnum"/>
>         <xsl:with-param name="stepindex" select="$stepindex"/>
>         <xsl:with-param name="yoffset" select="$yoffset"/>
>         <xsl:with-param name="maxyoffset" select="$maxyoffset"/>
>        </xsl:call-template>
>       </xsl:for-each>
>      </xsl:when>
>      <xsl:otherwise>
>       <xsl:call-template name="steps">
>        <xsl:with-param name="compnum" select="$compnum + 1"/>
>        <xsl:with-param name="stepindex" select="'1'"/>
>        <xsl:with-param name="yoffset" select="$maxyoffset"/>
>        <xsl:with-param name="maxyoffset" select="$maxyoffset"/>
>       </xsl:call-template>
>      </xsl:otherwise>
>     </xsl:choose>
>    </xsl:when>
>    <xsl:otherwise>
>     <xsl:element name="wf:view">
>      <xsl:element name="wf:maxy">
>       <xsl:value-of select="$maxyoffset"/>
>      </xsl:element>
>     </xsl:element>
>    </xsl:otherwise>
>   </xsl:choose>
>  </xsl:template>
>  <xsl:template name="step">
>   <xsl:param name="compnum"/>
>   <xsl:param name="stepindex"/>
>   <xsl:param name="yoffset"/>
>   <xsl:param name="maxyoffset"/>
>   <wf:step/>
>   <xsl:call-template name="steps">
>    <xsl:with-param name="compnum" select="$compnum"/>
>    <xsl:with-param name="stepindex" select="$stepindex + 1"/>
>    <xsl:with-param name="yoffset" select="$yoffset"/>
>    <xsl:with-param name="maxyoffset" select="$maxyoffset"/>
>   </xsl:call-template>
>  </xsl:template>
> </xsl:stylesheet>
> -------------------------------------------------------------
> in.xml:
> <?xml version="1.0" encoding="utf-8"?>
> <wf:flow xmlns:wf="http://www.emeldi.com/tboss/hot-deploy/workflow"; 
> name="ANONYMOUS-2">
> <wf:step flow-name="ANONYMOUS-2" name="Step-1">
> <wf:next-steps>
> <wf:next-step result="A-2-R1" name="Success"/>
> <wf:next-step result="*" name="Error"/>
> </wf:next-steps>
> <wf:step-number>1</wf:step-number>
> <wf:component-number>1</wf:component-number>
> </wf:step>
> <wf:step flow-name="ANONYMOUS-2" name="Error">
> <wf:next-steps/>
> <wf:step-number>2</wf:step-number>
> <wf:component-number>1</wf:component-number>
> </wf:step>
> <wf:step flow-name="ANONYMOUS-2" name="Success">
> <wf:next-steps/>
> <wf:step-number>2</wf:step-number>
> <wf:component-number>1</wf:component-number>
> </wf:step>
> <wf:step flow-name="ANONYMOUS-2" name="Start">
> <wf:next-steps>
> <wf:next-step result="A-1-R1" name="Step-1"/>
> <wf:next-step result="*" name="Error"/>
> </wf:next-steps>
> <wf:step-number>0</wf:step-number>
> <wf:component-number>1</wf:component-number>
> </wf:step>
> <wf:components>
> <wf:component pos="1" start="Start">
> <wf:step-name>Start</wf:step-name>
> <wf:step-name>Step-1</wf:step-name>
> <wf:step-name>Error</wf:step-name>
> <wf:step-name>Success</wf:step-name>
> </wf:component>
> </wf:components>
> </wf:flow>
> -------------------------------------------------------------
> xalan-test.sh:
> #!/bin/sh
> # Please change this to put to your Xalan:
> XALAN_HOME=/usr/local/xalan-j_2_7_1
> CLASSPATH='.'
> for i in ${XALAN_HOME}/*.jar
> do
>   CLASSPATH=$CLASSPATH:$i
> done
> # First the default
> ant default
> # Second the Xalan:
> export CLASSPATH
> ant xalan
> -------------------------------------------------------------
> <project name="xalan-problem" basedir="." default="default">
>  <description>
>   Shows a problem with XALAN processor
>  </description>
>  <target name="default">
>   <xslt
>    style="style.xsl"
>    in="in.xml"
>    out="out-default.xml"
>   />
>   </target>
>  <target name="xalan">
>   <xslt
>    style="style.xsl"
>    in="in.xml"
>    out="out-xalan.xml"
>   >
>    <factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
>   </xslt>
>  </target>
> </project>
> -------------------------------------------------------------
> $ ./xalan-test.sh 
> Buildfile: build.xml
> default:
>      [xslt] Processing /home/vaclav/work/xalan-problem/in.xml to 
> /home/vaclav/work/xalan-problem/out-default.xml
>      [xslt] Loading stylesheet /home/vaclav/work/xalan-problem/style.xsl
>      [xslt] : Warning! 
>      [xslt]                                                             
> COUNT=1
> BUILD SUCCESSFUL
> Total time: 0 seconds
> Buildfile: build.xml
> xalan:
>      [xslt] Processing /home/vaclav/work/xalan-problem/in.xml to 
> /home/vaclav/work/xalan-problem/out-xalan.xml
>      [xslt] Loading stylesheet /home/vaclav/work/xalan-problem/style.xsl
>      [xslt] /home/vaclav/work/xalan-problem/style.xsl:52:21: Warning! 
>      [xslt]                                                             
> COUNT=4
> BUILD SUCCESSFUL
> Total time: 0 seconds

-- 
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]

Reply via email to