<?xml version="1.0" encoding="UTF-8"?><!-- DWXMLSource="elements.xml" -->
<!-- http://153.18.145.30/~raupmart/assign1.htm -->
<!-- Raup, Martha -->
<!-- COIN 78b Section 01W Fall 2010 -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<xsl:stylesheet 
	version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:v="urn:schemas-microsoft-com:vml"     
    xmlns:svg="http://www.w3.org/2000/svg version='1.1'" >
 
 <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>

  <xsl:template match="/"> 
   
  		<xsl:apply-templates select="PERIODIC_TABLE" />
  </xsl:template>
 
  <xsl:template match="PERIODIC_TABLE">
  
<!-- <![CDATA[<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">]]> -->

   	 <html>
     	<head>
        	<title>Table of Elements</title>
            <style>v\: * { behavior:url(#default#VML);display:inline-block }</style>
        </head>
        
 	 	<body>
          <h1>Table of Elements</h1>
            <table border="1px">    
              <tr>
                  <th>Atomic Number</th>
                  <th>Symbol</th>      
                  <th>Name</th>
                  <th>Atomic Weight</th><th>Melting Point<br />(<xsl:value-of select="//MELTING_POINT/@UNITS" />)</th>
                 <th>Boiling Point<br />(<xsl:value-of select="//BOILING_POINT/@UNITS" />)</th>
                  <th>Atomic Radius<br />(<xsl:value-of select="//ATOMIC_RADIUS/@UNITS" />)</th>
                  <th>State<br />(@ 300K)</th>
              </tr>
              
          	<xsl:apply-templates select="//ATOM" />
          
               <tr> <td colspan="8">Total Number of Elements: <xsl:value-of select="count(//ATOMIC_NUMBER)" /></td> </tr>
                <!-- Code Assistance from: http://zvon.org/xxl/XSLTreference/OutputOverview/function_sum_frame.html -->    
           </table>
        </body>
 	 </html>
  </xsl:template>
  
  <xsl:template match="ATOM">
       
  <!-- Create a variable at top level to store the height & width of radius, where h & w = 10 x round(radius) -->  
    <xsl:variable name="state" select="round(ATOMIC_RADIUS)"/>
    <xsl:variable name="shape" select="$state * 10"/>    
    <xsl:variable name="BP" select="//BOILING_POINT" />    	
    <xsl:variable name="MP" select="//MELTING_POINT" />    	
    <xsl:variable name="SRT" select="298" /> 
	<xsl:variable name="gas">$BP &lt; $SRT and $MP &lt; $SRT</xsl:variable> 
    <xsl:variable name="solid">$BP &gt; $SRT and $MP &gt; $SRT</xsl:variable>
    <xsl:variable name="liquid">$MP &lt; $SRT and $BP &gt; $SRT</xsl:variable> 

     
 <tr> <xsl:for-each select="."><xsl:sort select="SYMBOL" /></xsl:for-each>
<!--   Code assistance from: http://www.java2s.com/Tutorial/XML/0100__XSLT-stylesheet/whentestpositionmod40.htm -->
          <xsl:attribute name="style">
              <xsl:choose>
                  <xsl:when test="position() mod 2 = 0">
                      <xsl:text>background: yellow;</xsl:text>
                  </xsl:when>
                  <xsl:otherwise>
                      <xsl:text>background: green;</xsl:text>
                      <xsl:text>color: white;</xsl:text>
                  </xsl:otherwise>
              </xsl:choose>              
           </xsl:attribute>
                    
      <td><xsl:value-of select="ATOMIC_NUMBER" /></td>
      <td><xsl:value-of select="SYMBOL" />      
           <xsl:attribute name="style">
             <xsl:text>background-color: blue;</xsl:text>
             <xsl:text>font-weight: bold;</xsl:text>
           </xsl:attribute></td>
        
      <td><xsl:value-of select="NAME" /></td>
      <td><xsl:value-of select="ATOMIC_WEIGHT" /></td>
      <td><xsl:value-of select="MELTING_POINT" /></td>
      <td><xsl:value-of select="BOILING_POINT" /></td>
      <td><xsl:value-of select="ATOMIC_RADIUS" /></td>
           

      <td>
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<circle cx="100" cy="50" r="40" stroke="black"
stroke-width="2" fill="red"/>

</svg>
      
      <svg xmlns="http://www.w3.org/2000/svg"
           xmlns:xlink="http://www.w3.org/1999/xlink"
           version="1.1"
           baseProfile="full">
        <g fill-opacity="0.7" stroke="black" stroke-width="0.1cm">
          <circle cx="6cm" cy="2cm" r="100" fill="red"
                          transform="translate(0,50)" />
          <circle cx="6cm" cy="2cm" r="100" fill="blue"
                          transform="translate(70,150)" />
          <circle cx="6cm" cy="2cm" r="100" fill="green"
                          transform="translate(-70,150)" />
        </g>
      </svg>
      
       <svg xmlns="http://www.w3.org/2000/svg" width="100" height="50">

  <ellipse cx="50" cy="25" rx="50" ry="25" fill="blue" stroke="none" />

</svg>  
      <!-- <xsl:if test="system-property('xsl:vendor') != Microsoft">
             <svg xmlns="http://www.w3.org/2000/svg" height="$state">
            	<circle cx="$state" cy="$state" r="$shape" id="circ" style="fill:red;"/>
          	</svg>
          </xsl:if> --> 
     <v:oval style="width:{$shape}; height:{$shape};"  />
          <xsl:choose> 
            	<xsl:when test="'$state = $gas'">
                	<xsl:attribute name="filled">
                    	<xsl:text>false</xsl:text>  
                    </xsl:attribute>
            	</xsl:when> 
                <xsl:when test="'$state = $solid'"> 
					<xsl:attribute name="fillcolor">           	
                		<xsl:text>blue</xsl:text>
                    </xsl:attribute>            
           		</xsl:when>            
            	<xsl:when test="$liquid">
                	<xsl:attribute name="fillcolor">            	
                		<xsl:text>white</xsl:text>
                    </xsl:attribute>               
            	</xsl:when>   	            	
        	</xsl:choose>               	                
		</td>    
	</tr>    

  </xsl:template>

</xsl:stylesheet>	