<?xml version="1.0"?>
<xsl:stylesheet version = "1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xhtml="http://www.w3.org/1999/xhtml" 
   xmlns="http://www.w3.org/1999/xhtml" 
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   exclude-result-prefixes="xhtml xsl xs">

<xsl:output method="xml" doctype-public="html" indent="yes" />
<xsl:param name="section_id">experience</xsl:param>

<!-- copy all nodes... -->
 <xsl:template match="@*|node()">
   <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
   </xsl:copy>
 </xsl:template>

<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="xhtml:body">
<body id="cvsite">
<div id="topofpage">&#160;</div>
<div id="menu">
  <ul>
    <li><a href="./">Home</a></li>
    <xsl:apply-templates  mode="menu" select="//xhtml:h1|.//xhtml:dl[@id='mainlang']|.//xhtml:div[@id='ehcontent']" />
  </ul>
  <form id="cv" action="LauraTyler2.html"  target="_blank"><input type="submit" value="full printable C.V." /></form>
   <ul id="inline">
   <li><a href="misc.php?page=About this site#cvsite">About this site</a></li>
   <li class="current">please note:<b><em>I am not looking for work</em></b></li>
   </ul>
</div>

<xsl:apply-templates />
</body>
</xsl:template>

<xsl:template match="xhtml:title">
<title>
  <xsl:value-of select="//*[@id=$section_id]/xhtml:h1" /><xsl:value-of select="//*[@id=$section_id]/xhtml:dl/xhtml:dt" />:<xsl:apply-templates />
</title>
</xsl:template>
<xsl:template match="xhtml:head">
<head>
<xsl:apply-templates />
</head>
</xsl:template>

<!--change to add the stylesheets -->
<xsl:template match="xhtml:link">
<link rel="stylesheet" href="css/another.css" type="text/css"/>
<link rel="stylesheet" href="css/print.css" type="text/css" media="print"/>
</xsl:template>

<xsl:template match="xhtml:div[@id='divmainlang']">
<xsl:choose>
 <xsl:when test="@id = $section_id">
   <h1>Languages</h1>
  <xsl:apply-templates />
</xsl:when><xsl:otherwise />
</xsl:choose>
</xsl:template> 

<xsl:template match="xhtml:div[@id='ehcontent']">
<xsl:choose>
 <xsl:when test="@id = $section_id">
   <div id="ehcontent">
   <h1>Employment History</h1>
  <xsl:apply-templates />
</div>
</xsl:when><xsl:otherwise />
</xsl:choose>
</xsl:template> 

<xsl:template match="xhtml:div[@id='experience'] | xhtml:div[@id='edcontent'] | xhtml:div[@id='pdcontent']">
<xsl:choose>
 <xsl:when test="@id = $section_id">
  <xsl:apply-templates />
</xsl:when><xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:template> 

<!--menu code -->
<xsl:template mode="menu" match="xhtml:h1">
  <xsl:choose>
    <xsl:when test="../@id = $section_id">
      <li class="current"><xsl:apply-templates /></li>
    </xsl:when>
    <xsl:otherwise>
  <li><a><xsl:attribute name="href">partcv.php?section_id=<xsl:value-of select="../@id" /></xsl:attribute><xsl:apply-templates /></a></li>     
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
<xsl:template mode="menu" match="xhtml:dl">
  <xsl:choose>
    <xsl:when test="../@id = $section_id">
      <li class="current"><xsl:value-of select="xhtml:dt" /></li>
    </xsl:when>
    <xsl:otherwise>
  <li><a><xsl:attribute name="href">partcv.php?section_id=<xsl:value-of select="../@id" /></xsl:attribute><xsl:value-of select="xhtml:dt" /></a></li>     
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
<xsl:template mode="menu" match="xhtml:div[@id='ehcontent']">
  <xsl:choose>
    <xsl:when test="@id = $section_id">
      <li class="current">Employment History</li>
    </xsl:when>
    <xsl:otherwise>
  <li><a><xsl:attribute name="href">partcv.php?section_id=<xsl:value-of select="@id" /></xsl:attribute>Employment History</a></li>     
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
<!-- end menu code-->

</xsl:stylesheet>
