Subject: Re: [xsl] Sudoku - A solution in XSLT 2 From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 16 Feb 2006 12:40:43 GMT |
Ah finally xsl being put to something useful!! (Doesn't seem to use templates really so probably could be converted to keep the xquery folks happy as well) I think that you can replace some $x in position() satisfies $x = by position() in all cases although if I read it right <xsl:param name="index" as="xs:integer+"/> can be <xsl:param name="index" as="xs:integer"/> in several places, I think it's just a single number isn't it? which means that fn:getGroup can be simplified to <xsl:function name="fn:getGroup" as="xs:integer+"> <xsl:param name="board" as="xs:integer+"/> <xsl:param name="index" as="xs:integer"/> <xsl:variable name="group" select="$groups[$index]"/> <xsl:sequence select="$board[for $x in position() return $groups[$x]= $group]"/> </xsl:function> where $groups is a global variable <xsl:variable name="groups" select="( 1,1,1, 2,2,2, 3,3,3, 1,1,1, 2,2,2, 3,3,3, 1,1,1, 2,2,2, 3,3,3, 4,4,4, 5,5,5, 6,6,6, 4,4,4, 5,5,5, 6,6,6, 4,4,4, 5,5,5, 6,6,6, 7,7,7, 8,8,8, 9,9,9, 7,7,7, 8,8,8, 9,9,9, 7,7,7, 8,8,8, 9,9,9 )" as="xs:integer+"/> David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Sudoku - A solution in XS, Eric Bréchemier | Thread | Re: [xsl] Sudoku - A solution in XS, andrew welch |
Re: [xsl] Sudoku - A solution in XS, Eric Bréchemier | Date | Re: [xsl] Sudoku - A solution in XS, andrew welch |
Month |