topical media & game development
basic-xml-08-CharactersChoose.xsl / xsl
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" >
<xsl:template match="/">
<html>
<head>
<title>Age check on all Characters.</title>
</head>
<body>
<h3>The following is the assessment of the age data.</h3>
<xsl:apply-templates select="/Characters/Character" />
</body>
</html>
</xsl:template>
<xsl:template match="Character">
<xsl:choose>
<xsl:when test="@age > 110 " >
<p><b><xsl:value-of select="." /></b> - too high. Please check if this character's age, <b><xsl:value-of select="@age" /></b>, is correct.</p>
</xsl:when>
<xsl:otherwise>
<p><b><xsl:value-of select="." /></b> - ok</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.