home *** CD-ROM | disk | FTP | other *** search
/ MacFormat UK 160 - Disc 2 / MF_UK_160_2.iso / pc / DiscContent / Trials / oxygen / samples / debugger / Templates / sample2.xsl < prev   
Encoding:
Extensible Markup Language  |  2005-07-21  |  1.2 KB  |  29 lines

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--    Category:       Templates
  3.     Sample from Zvon XSLT tutorial (www.zvon.org)  
  4.     Description:    Quite often several templates match the same element in XML source. 
  5.         It must be therefore decided which one should be used. This priority order can be 
  6.         specified with the priority attributte. If this attribute is not specified, its priority is calculated
  7.         according to several rules. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  9.     <xsl:template match="/">
  10.         <xsl:apply-templates select="//CCC"/>
  11.     </xsl:template>
  12.     <xsl:template match="CCC" priority="4">
  13.         <h3 style="color:blue">
  14.             <xsl:value-of select="name()"/>
  15.             <xsl:text> (id=</xsl:text>
  16.             <xsl:value-of select="@id"/>
  17.             <xsl:text>)</xsl:text>
  18.         </h3>
  19.     </xsl:template>
  20.     <xsl:template match="CCC/CCC" priority="3">
  21.         <h2 style="color:red">
  22.             <xsl:value-of select="name()"/>
  23.             <xsl:text> (id=</xsl:text>
  24.             <xsl:value-of select="@id"/>
  25.             <xsl:text>)</xsl:text>
  26.         </h2>
  27.     </xsl:template>
  28. </xsl:stylesheet>
  29.