Listing 1: animals.xml

<?xml version="1.0" encoding="utf-8"?>
<animals>
  <animal species="Feline" subspecies="Lion">
    <name>Roary</name>
    <sex>Female</sex>
    <color>Fawn</color>
    <weight>325 pounds</weight>
    <feedingTime>14:00</feedingTime>
  </animal>
  <animal species="Reptile" subspecies="Tortoise">
    <name>Shelly</name>
    <type>Box Turtle</type>
    <sex>Female</sex>
    <color>Green</color>
    <weight>20 pounds</weight>
    <feedingTime>15:00</feedingTime>
  </animal>
  <animal species="Feline" subspecies="Leopard">
    <name>Stealthy</name>
    <sex>Male</sex>
    <color>Black</color>
    <weight>250 pounds</weight>
    <feedingTime>11:00</feedingTime>
  </animal>
  <animal species="Reptile" subspecies="Snake">
    <name>Bitey</name>
    <type>Rattlesnake</type>
    <sex>Male</sex>
    <color>Gray</color>
    <weight>4 pounds</weight>
    <feedingTime>19:00</feedingTime>
  </animal>
</animals>

Listing 2: animalsHtml.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0">
  <xsl:output method="html" />
  <xsl:template match="/animals">
    <html>
      <head>
        <title>Our Zoo Animals</title>
      </head>
      <body>
        <h3>Our Zoo Animals</h3>
        <table border="0" width="80%" cellpadding="2" cellspacing=
		"1" bgcolor="#999999">
        <tr bgcolor="#dedede">
          <th>Species</th>
          <th>Sub-Species</th>
          <th>Name</th>
          <th>Type</th>
          <th>Sex</th>
          <th>Color</th>
          <th>Weight</th>
          <th>Feeding Time</th>
        </tr>
        <xsl:for-each select="animal">
          <tr bgcolor="#ffffff">
            <td><xsl:value-of select="@species" /></td>
            <td><xsl:value-of select="@subspecies" /></td>
            <td><xsl:value-of select="name" /></td>
            <td><xsl:value-of select="type" /></td>
            <td><xsl:value-of select="sex" /></td>
            <td><xsl:value-of select="color" /></td>
            <td><xsl:value-of select="weight" /></td>
            <td><xsl:value-of select="feedingTime" /></td>
          </tr>
        </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Listing 3: displayAnimals.cfm

<!--- read in animals.xml --->
<cffile action="read" file="#ExpandPath('.')#/animals.xml"
 variable="animalsXml" />

<!--- read in animalsHtml.xsl --->
<cffile action="read" file="#ExpandPath('.')#/animalsHtml.xsl"
 variable="animalsXsl" />

<!--- transform and output --->
<cfoutput>#XmlTransform(animalsXml, animalsXsl)#</cfoutput>

Listing 4: felinesHtml.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0">
  <xsl:output method="html" />
  <xsl:template match="/animals">
    <html>
      <head>
        <title>Feline Feeding Schedule</title>
      </head>
      <body>
        <h3>Feline Feeding Schedule</h3>
        <table border="0" width="80%" cellpadding="2" cellspacing="1"
		bgcolor="#999999">
          <tr bgcolor="#dedede">
            <th>Species</th>
            <th>Sub-Species</th>
            <th>Name</th>
            <th>Sex</th>
            <th>Color</th>
            <th>Weight</th>
            <th>Feeding Time</th>
          </tr>
          <xsl:for-each select="animal">
            <xsl:sort select="feedingTime" />
            <xsl:if test="@species='Feline'">
              <tr bgcolor="#ffffff">
                <td><xsl:value-of select="@species" /></td>
                <td><xsl:value-of select="@subspecies" /></td>
                <td><xsl:value-of select="name" /></td>
                <td><xsl:value-of select="sex" /></td>
                <td><xsl:value-of select="color" /></td>
                <td><xsl:value-of select="weight" /></td>
                <td><xsl:value-of select="feedingTime" /></td>
              </tr>
            </xsl:if>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Listing 5: displayFelines.cfm

<!--- read in animals.xml --->
<cffile action="read" file="#ExpandPath('.')#/animals.xml"
variable="animalsXml" />

<!--- read in felinesHtml.xsl --->
<cffile action="read" file="#ExpandPath('.')#/felinesHtml.xsl"
variable="felinesXsl" />

<!--- transform and output --->
<cfoutput>#XmlTransform(animalsXml, felinesXsl)#</cfoutput>