xsl-list
[Top] [All Lists]

Re: [xsl] FizzBuzz in XSLT 1.0. Help with a 2.0/FXSL solution?

2007-03-14 11:10:16
On Wed, 14 Mar 2007 11:51:14 -0600, David Carlisle 
<davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
   <xsl:output method="text"/>
   <xsl:template match="fizzbuzz">
     <xsl:variable name="m" select="test/mod"/>
     <xsl:for-each select="xs:integer(substring-before(range,'-')) to 
xs:integer(substring-after(range,'-'))">
       <xsl:text>&#10;</xsl:text>
       <xsl:variable name="r" select="$m[(current() mod @value) = @test]"/>
       <xsl:value-of separator="" select="if($r) then $r else ."/>
     </xsl:for-each>
   </xsl:template>
</xsl:stylesheet>

Nice!  I've created a new post to capture both this and any other solutions 
provided.

http://dev.aol.com/blog/mdavidpeterson/2007/03/14/fizz-buzz-in-xslt-2.0

Thanks, David!

--
/M:D

M. David Peterson
http://mdavid.name | http://www.oreillynet.com/pub/au/2354 | 
http://dev.aol.com/blog/3155

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--