Wrong transformation results using XSLTC
----------------------------------------

                 Key: XALANJ-2531
                 URL: https://issues.apache.org/jira/browse/XALANJ-2531
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in 
Xalan projects.  Anybody can view the issue.)
          Components: XSLTC
    Affects Versions: 2.7.1
            Reporter: Fernando Crespo


The following XSTL transformation produces wrong results when it is applied 
using XSLTC.

Input XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<specification>
    <class>
        <identifier>MyClass1</identifier>
    </class>
    
    <class>
        <identifier>MyClass2</identifier>
        <extends>
            <identifier>MyClass1</identifier>
        </extends>
        <directive kind="public"/>
    </class>    
</specification>

Transformation:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:output encoding="UTF-8" method="text"/>    
    <xsl:template match="class">
        <xsl:if test="./identifier = 'MyClass2'">
            <xsl:variable 
                name="baseClassNode"
                select="/specification/class[./identifier/text() = 
'MyClass1']"/>
    
            <xsl:choose>
                <xsl:when test="$baseClassNode//directive[@kind='public']">
                    <xsl:text>ERROR</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>SUCCESS</xsl:text>
                </xsl:otherwise>
            </xsl:choose>                        
        </xsl:if>
    </xsl:template>        
</xsl:stylesheet>

After applying the transformation to the input XML you should get SUCCESS. This 
is what I get when I use interpreted XALAN. However, when I compile the 
transformation for XSLTC I got ERROR.

To compile the transformation I used the following command line:

java org.apache.xalan.xsltc.cmdline.Compile Transformation.xslt

To apply the transformation I used the following command line:

java org.apache.xalan.xsltc.cmdline.Transform -u Document.xml Transformation


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

Reply via email to