Answer 4: Literal Character Data and Markup

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="NAME">
    <h2><xsl:value-of select="."/></h2>
  </xsl:template>

 <xsl:template match="ATOMIC_WEIGHT">
    <p>Atomic Weight: <xsl:value-of select="."/></p>
  </xsl:template>

  <xsl:template match="ATOMIC_NUMBER">
    <p>Atomic Number: <xsl:value-of select="."/></p>
  </xsl:template>

 <xsl:template match="OXIDATION_STATES">
    <p>Oxidation States:<xsl:value-of select="."/></p>
  </xsl:template>

 <xsl:template match="BOILING_POINT">
    <p>Boiling point:<xsl:value-of select="."/></p>
  </xsl:template>

 <xsl:template match="SYMBOL">
    <p>Symbol: <span style="font-style: italic"><xsl:value-of select="."/></span></p>
  </xsl:template>

 <xsl:template match="DENSITY">
    <p>Density:<xsl:value-of select="."/></p>
  </xsl:template>

 <xsl:template match="ELECTRON_CONFIGURATION">
    <p>Electron Configuration:<xsl:value-of select="."/></p>
  </xsl:template>

 <xsl:template match="ELECTRONEGATIVITY">
    <p>Electonegativty:<xsl:value-of select="."/></p>
  </xsl:template>

 <xsl:template match="ATOMIC_RADIUS">
    <p>Atomic radius: <xsl:value-of select="."/></p>
  </xsl:template>

 <xsl:template match="ATOMIC_VOLUME">
    <p>Atomic volume:<xsl:value-of select="."/></p>
  </xsl:template>

 <xsl:template match="IONIZATION_POTENTIAL">
    <p>Ionization potential:<xsl:value-of select="."/></p>
  </xsl:template>

  <xsl:template match="THERMAL_CONDUCTIVITY">
    <p>Thermal conductivity:<xsl:value-of select="."/></p>
  </xsl:template>
  
</xsl:stylesheet>
View Transformed Document in Browser
Previous | Next | Top | Cafe con Leche

Copyright 2002, 2003 Elliotte Rusty Harold
Elliotte Rusty Harold
Last Modified October 14, 2002