[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Xmas Tree
Michael Kay's sheet was a neat trick, but I couldn't find a Christmas Cracker in it. Here's a more straightforward offering. Merry Christmas. ===========Stylesheet============== <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:variable name='width' select='number(*)'/> <xsl:text>'****Merry Xmas!****' </xsl:text> <xsl:call-template name='print_row'> <xsl:with-param name="curr_width" select="$width"/> <xsl:with-param name="total_width" select="$width"/> </xsl:call-template> </xsl:template> <xsl:template name="print_row"> <xsl:param name="curr_width"/> <xsl:call-template name='spacer'> <xsl:with-param name="counter" select="$curr_width div 2"/> </xsl:call-template> <xsl:call-template name='next_in_row'> <xsl:with-param name="counter" select="$total_width - $curr_width"/> </xsl:call-template> <xsl:if test='$curr_width != 1'> <xsl:call-template name='print_row'> <xsl:with-param name="curr_width" select="$curr_width - 2"/> <xsl:with-param name="total_width" select="$total_width"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template name="next_in_row"> <xsl:param name="counter"/> <xsl:text>*</xsl:text> <xsl:choose> <xsl:when test='$counter != 0'> <xsl:call-template name='next_in_row'> <xsl:with-param name="counter" select="$counter - 1"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="spacer"> <xsl:param name="counter"/> <xsl:text> </xsl:text> <xsl:if test='floor($counter) != 0'> <xsl:call-template name='spacer'> <xsl:with-param name="counter" select="$counter - 1"/> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> ===========XML Source============== <tree-width>15</tree-width> -- Uche Ogbuji FourThought LLC, IT Consultants uche.ogbuji@xxxxxxxxxxxxxxx (970)481-0805 Software engineering, project management, Intranets and Extranets http://FourThought.com http://OpenTechnology.org XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|