1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-08 21:42:07 +03:00
Files
libxslt/tests/XSLTMark/bottles.xsl
Daniel Veillard fb0a57cf03 Jumbo patch, extended regression tests and fixed regression results:
- configure.in tests/Makefile.am tests/XSLTMark/* tests/multiple:
  added the XSLTMark in the regression tests as well as multiple
  output test from Ankh
- libxslt/functions.c libxslt/keys.c libxslt/transform.c
  libxslt/variables.c libxslt/xsltutils.c: applied William M. Brack
  patches and fixed a memory leak
- tests/docbook/result/html/*.html : updated the results after
  William's patch
- tests/xmlspec/REC-xml-20001006-review.html
  tests/xmlspec/REC-xml-20001006.html: libxml now don't invent
  an HTML doctype when serializing HTML result, but adds the
  encoding in ALT
Daniel
2001-04-02 15:13:28 +00:00

65 lines
2.0 KiB
XML

<?xml version="1.0"?>
<!-- bottles of beer by Cyrus Dolph May 16, 2000 -->
<!-- input template of form: <bottles>99</bottles> -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8"/>
<xsl:template name="bottles">
<xsl:param name="bottles"/>
<xsl:choose>
<xsl:when test="$bottles = 1">
<xsl:text>1 bottle</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select='concat ($bottles, " bottles")'/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="verse">
<xsl:param name="bottles"/>
<xsl:choose>
<xsl:when test="$bottles = 0">
<xsl:text>0 bottles of beer on the wall,
0 bottles of beer!
Go into town, buy a new round
Get some more bottles of beer on the wall!
</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="bottles">
<xsl:with-param name="bottles" select="$bottles"/>
</xsl:call-template>
<xsl:text> of beer on the wall,
</xsl:text>
<xsl:call-template name="bottles">
<xsl:with-param name="bottles" select="$bottles"/>
</xsl:call-template>
<xsl:text> of beer!
Take one down, pass it around;
</xsl:text>
<xsl:call-template name="bottles">
<xsl:with-param name="bottles" select="$bottles - 1"/>
</xsl:call-template>
<xsl:text> of beer on the wall.
</xsl:text>
<xsl:call-template name="verse">
<xsl:with-param name="bottles" select="$bottles - 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/">
<xsl:call-template name="verse">
<xsl:with-param name="bottles" select="/bottles"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>