title: Using multiple xsl templates with one xml
body: <p>I'm new to xsl templates, but I haven't found a way yet to do what I'm wanting. It seems like this should be possible. </p>
  
  <p>What I want is to have multiple templates for one xml file. I'm doing an online resume, so I have my resume.xml file. I would like to have my onlineResume.xsl template, my downloadWord.xsl template, and my downloadPDF.xsl template. These three templates would be rendered based on what tab is selected on a master webpage. </p>
  
  <p>Right now I have the below as test. The bodies aren't fleshed out, obviously, but I can't get past linking more than one stylesheet depending on which link is followed. I'm open to php, javascript/jquery, xsl, xml, xpath or whatever is needed. My website is developed server-side with php. </p>
  
  <p>HTML home page</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;a href="./resume.xml"&gt;Online Resume&lt;/a&gt;
  &lt;a href="./resume.xml"&gt;Download Word&lt;/a&gt;
  &lt;a href="./resume.xml"&gt;Download PDF&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="onlineCV.xsl"?&gt;
  &lt;resume&gt;
      &lt;personal_info&gt;
          &lt;birthdate&gt;07/08/1988&lt;/birthdate&gt;
      &lt;/personal_info&gt;
      &lt;jobs&gt;
          &lt;job&gt;
              &lt;company&gt;Radio Shack&lt;/company&gt;
              &lt;title&gt;Sales Representative&lt;/title&gt;
              &lt;startdate&gt;01/01/2011&lt;/startdate&gt;
              &lt;enddate&gt;02/02/2011&lt;/enddate&gt;
              &lt;duration&gt;1.5yrs&lt;/duration&gt;
              &lt;sortdate&gt;20110101&lt;/sortdate&gt;
          &lt;/job&gt;
          &lt;job&gt;
              &lt;company&gt;Radio Shack2&lt;/company&gt;
              &lt;title&gt;Sales Representative&lt;/title&gt;
              &lt;startdate&gt;01/01/2013&lt;/startdate&gt;
              &lt;enddate&gt;02/02/2013&lt;/enddate&gt;
              &lt;duration&gt;1.5yrs&lt;/duration&gt;
              &lt;sortdate&gt;20130202&lt;/sortdate&gt;
          &lt;/job&gt;
      &lt;/jobs&gt;
  &lt;/resume&gt;
  </code></pre>
  
  <p>Online Resume</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
    &lt;body&gt;
    &lt;h2&gt;My Resume&lt;/h2&gt;
          &lt;xsl:for-each select="resume/jobs/job"&gt;
          &lt;xsl:sort select="sortdate" data-type="number" order="descending" /&gt;
          &lt;div&gt;
  
              &lt;xsl:value-of select="company" /&gt; - &lt;xsl:value-of select="title"/&gt;
          &lt;/div&gt;
        &lt;/xsl:for-each&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Download Word</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
    &lt;body&gt;
    &lt;h2&gt;My Word Download&lt;/h2&gt;
          &lt;xsl:for-each select="resume/jobs/job"&gt;
          &lt;xsl:sort select="sortdate" data-type="number" order="descending" /&gt;
          &lt;div&gt;
  
              &lt;xsl:value-of select="company" /&gt; - &lt;xsl:value-of select="title"/&gt;
          &lt;/div&gt;
        &lt;/xsl:for-each&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Download PDF</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
    &lt;body&gt;
    &lt;h2&gt;My PDF Download&lt;/h2&gt;
          &lt;xsl:for-each select="resume/jobs/job"&gt;
          &lt;xsl:sort select="sortdate" data-type="number" order="descending" /&gt;
          &lt;div&gt;
  
              &lt;xsl:value-of select="company" /&gt; - &lt;xsl:value-of select="title"/&gt;
          &lt;/div&gt;
        &lt;/xsl:for-each&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>