<?xml version="1.0"?>

<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" />
<xsl:template match="Example">
 <html>
   <head>
     <title>Design Patterns -
       <xsl:value-of select="name"/>
     </title>
	
	 <style  type="text/css">
UL 	 { 	 margin-left: 0px; padding: 2px; padding-left: 0px;}
UL LI { 	
font-size: 11pt; line-height:normal;
margin: 0px; margin-top: 0px; margin-left: 10px;
padding: 0px; border: 0px }
UL LI.first   	{ 	margin-top: 0px }
	 </style>
   </head>
   <body leftmargin="3px" topmargin="3px" rightmargin="3px"><a name="top" id="top"></a>
   <table width="700" cellpadding="0" cellspacing="0">
   	<tr>
	<td>
   	<div align="center">
  <h1>
    <xsl:value-of select="name"/>
  </h1>

	<xsl:for-each select="alter_name">
	 (  <xsl:value-of select="." />)
	</xsl:for-each>

  
  </div> 	
  <ul>
     <xsl:apply-templates/>
  </ul>
  </td>
  </tr>
  </table>
   </body>
 </html>
</xsl:template>

<xsl:template match="alter_name" />
<xsl:template match="name" />
<xsl:template match="Example/what">
  <li>	
  	<a name="what" id="what"></a>
  <h4>Intent </h4>
    <xsl:apply-templates/>
   </li>
</xsl:template>
<xsl:template match="Example/when">
	<li>
		<a name="when" id="when"></a>
  <h4>Use When </h4>
    <xsl:apply-templates/>
	</li>
</xsl:template>
<xsl:template match="sample/when">
	<li>
  <strong>Use When: </strong>
    <xsl:apply-templates/>
	</li>
</xsl:template>
<xsl:template match="Example/how">
  <li>
  	<a name="how" id="how"></a>
  <h4>How </h4>
    <xsl:apply-templates/>
  </li>
</xsl:template>
<xsl:template match="sample/how">
  <li>
  <strong>How: </strong>
    <xsl:apply-templates/>
  </li>
</xsl:template>
<xsl:template match="why">
	<li>
	<a name="why" id="why"></a>
  <h4>Why</h4>
    <xsl:apply-templates/>
	</li>
</xsl:template>
<xsl:template match="samples">
 <li>
 	<a name="samples" id="samples"></a>
  <h4>Samples</h4>
  <ul  style="margin-left:20px">
    <xsl:apply-templates/>
   </ul>
  </li>
</xsl:template>
<xsl:template match="samples/sample">
  <li>Sample: <b>
  	<xsl:value-of select="name"/> 
   </b>
   <ul style="margin-left:30px">
    <xsl:apply-templates/>
	</ul>
  </li>
</xsl:template>

<xsl:template match="section/title">
  <h3>
    <xsl:apply-templates/>
  </h3>
</xsl:template>

<xsl:template match="relatedPatterns">
	<li>
	<h4>Related Patterns:</h4>
    <ul>
    <xsl:apply-templates/>
  	</ul>
	</li>
</xsl:template>
<xsl:template match="relatedPattern">
  <li><b>Pattern:</b>
    <xsl:apply-templates/>
  </li>
</xsl:template>

<xsl:template match="paragraph">
  <p>
    <xsl:apply-templates/>
  </p>
</xsl:template>

<xsl:template match="note">
  <p class="note">
    <b>NOTE: </b>
    <xsl:apply-templates/>
  </p>
</xsl:template>

<xsl:template match="diagram">
<div align="center">
<xsl:apply-templates />
</div>
</xsl:template>
<xsl:template match="img">
  <xsl:copy-of select="." />
</xsl:template>
<xsl:template match="a">
  <xsl:copy-of select="." />
</xsl:template>
<xsl:template match="patternLink">
	<xsl:element name="a">
		<xsl:attribute name="href">
			/view.php?dir=files%2FPatterns%2F<xsl:apply-templates />
		</xsl:attribute>
		<xsl:attribute name="target">new</xsl:attribute>
		 <xsl:apply-templates />
	</xsl:element>
</xsl:template>
<xsl:template match="patternName">
	<strong><em>
		<xsl:apply-templates />
		</em>
	</strong>
</xsl:template>
<xsl:template match="file">
<p>
	<xsl:element name="a">
		<xsl:attribute name="href">
			<xsl:value-of select="@href" />
		</xsl:attribute>
		Click to download <xsl:value-of select="@href" />
	</xsl:element>
</p>
</xsl:template>

<xsl:template match="animation">
<p>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="600" height="450" id="slidesshow" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<xsl:element name="param">
	<xsl:attribute name="name">movie</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="@src" /></xsl:attribute>
</xsl:element>
<param name="quality" value="high" /><param name="bgcolor" value="#000000" />
<xsl:element name="embed">
	<xsl:attribute name="src"><xsl:value-of select="@src" /></xsl:attribute>
	<xsl:attribute name="quality">high</xsl:attribute>
	<xsl:attribute name="bgcolor">#000000</xsl:attribute>
	<xsl:attribute name="width">600</xsl:attribute>
	<xsl:attribute name="height">450</xsl:attribute>
	<xsl:attribute name="name"><xsl:value-of select="@src" /></xsl:attribute>
	<xsl:attribute name="align">middle</xsl:attribute>
	<xsl:attribute name="allowScriptAccess">sameDomain</xsl:attribute>
	<xsl:attribute name="type">application/x-shockwave-flash</xsl:attribute>
	<xsl:attribute name="pluginspage">http://www.macromedia.com/go/getflashplayer</xsl:attribute>
</xsl:element>
</object>
</p>
</xsl:template>


<xsl:template match="arg">
  <em>
    <xsl:apply-templates/>
  </em>
</xsl:template>
<xsl:template match="em">
  <em>
    <xsl:apply-templates/>
  </em>
</xsl:template>
<xsl:template match="strong">
  <strong>
    <xsl:apply-templates/>
  </strong>
</xsl:template>
<xsl:template match="b">
  <strong>
    <xsl:apply-templates/>
  </strong>
</xsl:template>
<xsl:template match="pre">
  <pre>
    <xsl:value-of select='translate(.,"&#x09;"," ")' />
  </pre>
</xsl:template>
<xsl:template match="*">
  <xsl:copy />
</xsl:template>
<xsl:template match="ul">
  <ol>
    <xsl:apply-templates/>
  </ol>
</xsl:template>
<xsl:template match="ol">
  <ol>
    <xsl:apply-templates/>
  </ol>
</xsl:template>
<xsl:template match="li">
  <li>
    <xsl:apply-templates/>
  </li>
</xsl:template>
</xsl:transform>

