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

Xmas Tree

Subject: Xmas Tree
From: uche.ogbuji@xxxxxxxxxxxxxxx
Date: Mon, 20 Dec 1999 02:02:15 -0700
christmas cracker template
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!****'&#10;&#10;</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>&#10;</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


Current Thread
  • Xmas Tree
    • uche . ogbuji - Mon, 20 Dec 1999 02:02:15 -0700 <=

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.