DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3826>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3826

Invalid Recursion

           Summary: Invalid Recursion
           Product: XalanJ2
           Version: 2.0.1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: org.apache.xalan.transformer
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


There appears to be some problem when uncoiling a recursive loop generated by 
apply-templates calls.

The XML:
<xml><row messageid="1" parentid="null" timeposted="25/09/01 17:05" name="Simon 
Jackson"><![CDATA[First Message]]></row><row messageid="2" parentid="1" 
timeposted="25/09/01 17:05" name="Simone Jackson"><![CDATA[Message in Reply]]
></row><row messageid="3" parentid="2" timeposted="25/09/01 17:05" name="Cooper 
Jackson"><![CDATA[Message in Reply to the Reply]]></row><row messageid="4" 
parentid="1" timeposted="25/09/01 17:05" name="Simon Jackson"><![CDATA[Replying 
to Myself]]></row><row messageid="5" parentid="null" timeposted="25/09/01 
17:05" name="Simon Jackson"><![CDATA[New Top Level message]]></row></xml>

The (relevant) XSL:
:SNIP--------------------
                        <xsl:for-each select="//row[@parentid = 'null']">
                                <xsl:variable name="myid"><xsl:value-of 
select="@messageid"/></xsl:variable>
                                <ul>
                                <li><xsl:value-of select="."/></li>
                                <xsl:apply-templates select="//row[@parentid = 
$myid]"/>
                                </ul>                           
                        </xsl:for-each>
                        <!--<xsl:apply-templates select="//row[@parentid 
= 'null']"/>--> <!-- get the top-level parent messages -->

                </html>
        </xsl:template>

        <xsl:template match="row">
                <xsl:param name="myid"><xsl:value-of 
select="@messageid"/></xsl:param>
                <ul>
                <li><xsl:value-of select="."/></li>
                <xsl:apply-templates select="//row[@parentid = $myid]"/>
        <!-- should recursively call this template -->
                </ul>
        </xsl:template>
END SNIP -----------------------

This is intended to come out like this:

First Message 
    Message in Reply 
        Message in Reply to the Reply 
    Replying to Myself 
New Top Level message 

...and it does with Sablotron, Saxon, MSXML but on Xalan:

First Message 
    Message in Reply 
        Message in Reply to the Reply 
    Replying to Myself 
        Message in Reply to the Reply 
New Top Level message 
    Message in Reply 
        Message in Reply to the Reply 
    Replying to Myself 
        Message in Reply to the Reply 

The only thing I can see is that as the loop unwinds it may be using the wrong 
index for the next recursion in the series...

Reply via email to