[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: problem endless rekursion

Subject: RE: problem endless rekursion
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 6 Nov 2003 09:41:16 -0000
xsl rekursion
This code:

<xsl:template match="option" mode="check">
  <xsl:variable name="correct_cells" 
        select=".|following-sibling::solution[valid_input = 1]" />
  <xsl:apply-templates select="$correct_cells" mode="check" />

certainly produces endless recursion, because the nodes selected by
apply-templates include the current node, and the same template rule
will be selected to process this node.

But I've no idea what the code was trying to achieve, so I've no idea
how it should be corrected.

Michael Kay  

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Markus Hanel
> Sent: 06 November 2003 08:16
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  problem endless rekursion
> 
> 
> hallo,
> can you please help me with the following problem.
> the problem is to check a check box question. the correct 
> cells and the false cells should be added. the result are the 
> correct cells. there is a endless rekursion?????
> 
> xml part
> <CheckBoxQuestion>
>   <notice>in Europa kennen wir uns aus!</notice>
>   <question>Welche der nachfolgenden Länder gehören zur EU?</question>
>   <option number="1">
>     <text>Deutschland</text>
>     <solution type="bool" points="4" valid_input="1"></solution>
>   </option>
>   <option number="2">
>     <text>Schweiz</text>
>     <solution type="bool" points="5" valid_input="0"></solution>
>   </option>
>   <option number="3">
>     <text>Österreich</text>
>     <solution type="bool" points="6" valid_input="1"></solution>
>   </option>
>   <option number="4">
>     <text>Türkei</text>
>     <solution type="bool" points="7" valid_input="0"></solution>
>   </option>
> </CheckBoxQuestion>
> 
> xsl part
> <xsl:template match="CheckBoxQuestion" mode="table">
>   <xsl:apply-templates select="option" mode="check" /> </xsl:template>
> 
> 
> <xsl:template match="option" mode="check">
>   <xsl:variable name="correct_cells" select=".
> |following-sibling::solution[valid_input = 1]" />
>   <xsl:apply-templates select="$correct_cells" mode="check" />
> 
>   <xsl:variable name="false_cells" select=".
> |following-sibling::solution[valid_input = 0]" />
>   <xsl:apply-templates select="$false_cells" mode="check" />
> 
>     <xsl:variable name="correct" 
> select="count($correct_cells) - count($false_cells)" />
> 
>     <xsl:choose>
>       <xsl:when test="$correct &gt;= 0">
>         <td><xsl:value-of select="$correct" /></td>
>       </xsl:when>
>       <xsl:otherwise>
>         <td>0</td>
>       </xsl:otherwise>
>     </xsl:choose>
> 
> </xsl:template>
> 
> <xsl:template match="solution" mode="check">
> </xsl:template>
> 
> -- 
> NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien... 
> Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
> 
> Jetzt kostenlos anmelden unter http://www.gmx.net
> 
> +++ GMX - die erste Adresse für Mail, Message, More! +++
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.