Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] [XSL] Accessing part of the result tree illustrated with "The Sudoku solver" example.

From: "Michael Kay" <mike@------------>
To:
Date: 9/5/2007 7:44:00 AM
> But experts as you are, you would have noticed that there is a major 
> BUG: even when we have found the solution, the recursion continues!..
> So you can get "lucky" and find a solution in the first seconds, then 
> run for many minutes uselessly just terminating the recursion.

A Sudoku puzzle can in general have more than one solution, and I think,
without studying it in detail, that your code is written to find all the
solutions. If you only want the first solution, the answer is to do:

<xsl:variable name="all-solutions" as="...">
  ... your algorithm here ...
</xsl:variable>
<xsl:sequence select="$all-solutions[1]"/>

An intelligent pipelined XSLT processor will evaluate $all-solutions lazily,
and will recognize the "[1]" as indicating that after finding the first
element in $all-solutions, no further processing is needed.

Michael Kay
http://www.saxonica.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent