title: Display links from xml data
body: <p>How can I display a clickable a href link on my html page from data exported from a xml page? below is the code I'm using. All the data exports fine, just the links cannot be clicked. so basically if a user clicks the item1.html link in the exported table he gets directed to item1.html page</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;body onload="transformxml()"&gt;
  &lt;div id="result_output"&gt;&lt;/div&gt;
  &lt;textarea id="xmlcode" style="display:none"&gt;
  &lt;catalog&gt;
    &lt;cd&gt;
      &lt;title&gt;Item1&lt;/title&gt;
      &lt;start&gt;09:15&lt;/start&gt;
      &lt;stop&gt;10:00&lt;/stop&gt;
      &lt;link&gt;&lt;a href="item1.hml"&gt;Item 1&lt;/a&gt;&lt;/link&gt;
    &lt;/cd&gt;
    &lt;cd&gt;
      &lt;title&gt;Item2&lt;/title&gt;
      &lt;start&gt;10:15&lt;/start&gt;
      &lt;stop&gt;11:00&lt;/stop&gt;
      &lt;link&gt;&lt;a href="item2.hml"&gt;Item 2&lt;/a&gt;&lt;/link&gt;
   &lt;/cd&gt;
     &lt;cd&gt;
        &lt;title&gt;Item3&lt;/title&gt;
        &lt;start&gt;12:15&lt;/start&gt;
        &lt;stop&gt;13:00&lt;/stop&gt;
        &lt;link&gt;&lt;a href="item3.hml"&gt;Item 3&lt;/a&gt;&lt;/link&gt;
     &lt;/cd&gt;
    &lt;cd&gt;
     &lt;title&gt;Item4&lt;/title&gt;
     &lt;start&gt;14:15&lt;/start&gt;
     &lt;stop&gt;15:00&lt;/stop&gt;
     &lt;link&gt;&lt;a href="item4.hml"&gt;Item 4&lt;/a&gt;&lt;/link&gt;
   &lt;/cd&gt;
    &lt;cd&gt;
     &lt;title&gt;Item5&lt;/title&gt;
     &lt;start&gt;15:15&lt;/start&gt;
     &lt;stop&gt;16:00&lt;/stop&gt;
     &lt;link&gt;&lt;a href="item5.hml"&gt;Item 5&lt;/a&gt;&lt;/link&gt;
    &lt;/cd&gt;
  &lt;catalog&gt;
  &lt;/textarea&gt;
  </code></pre>
  
  <p>xsl</p>
  
  <pre><code>&lt;textarea id="xsltcode" style="display:none"&gt;
  &lt;?xml version="1.0" encoding="ISO-8859-1"?&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;timetable&lt;/h2&gt;
    &lt;table border="1"&gt;
    &lt;tr&gt;
      &lt;th style="text-align:left"&gt;Start&lt;/th&gt;
      &lt;th style="text-align:left"&gt;Stop&lt;/th&gt;
      &lt;th style="text-align:left"&gt;Title&lt;/th&gt;
      &lt;th style="text-align:left"&gt;Link&lt;/th&gt;
    &lt;/tr&gt;
    &lt;xsl:for-each select="catalog/cd"&gt;
    &lt;xsl:sort select="start"/&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;xsl:value-of select="start"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;xsl:value-of select="stop"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;xsl:value-of select="title"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;xsl:value-of select="link"/&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/xsl:for-each&gt;
    &lt;/table&gt;
   &lt;/body&gt;
   &lt;/html&gt;
  &lt;/xsl:template&gt;
   &lt;/xsl:stylesheet&gt;
  &lt;/textarea&gt;
  </code></pre>
  
  <p>script</p>
  
  <pre><code>&lt;script&gt;
  function transformxml()
    {
    if (window.ActiveXObject)
     {
     // IE
  
    // XML:
    var xmltxt
    xmltxt=document.getElementById("xmlcode").value
     if (xmltxt=="")
      {
      alert("The XML is empty")
      return false;
      }
    xml=new ActiveXObject("MSXML2.DOMDocument");
    xml.async=false
    xml.loadXML(xmltxt)
    if (xml.parseError.errorCode!=0)
      {
       document.write("Error in XML&lt;br&gt;&lt;br&gt;Line " + xml.parseError.line + ": " +      xml.parseError.reason);         
        alert("Error in XML\n\nLine " + xml.parseError.line + ": " + xml.parseError.reason);
        return false
      }
    // XSL:
    var xsltxt
    xsltxt=document.getElementById("xsltcode").value
    if (xsltxt=="")
      {
      alert("The XSLT is empty")
      return false
      }
    xsl=new ActiveXObject("Microsoft.XMLDOM")
    xsl.async=false
    xsl.loadXML(xsltxt)
    if (xsl.parseError.errorCode!=0)
      {
        document.write("Error in XSLT&lt;br&gt;&lt;br&gt;Line " + xsl.parseError.line + ": " +   xsl.parseError.reason);                  
        alert("Error in XSLT\n\nLine " + xsl.parseError.line + ": " + xsl.parseError.reason);
        return false
        }
  
    // Transform:
    document.write(xml.transformNode(xsl));                   
   }
  else if (document.implementation &amp;&amp; document.implementation.createDocument)
  {
  // Mozilla
  // XML:
  var xmltxt
  xmltxt=document.getElementById("xmlcode").value
  if (xmltxt=="")
      {
      alert("The XML is empty")
      return false
      }
  var doc=new DOMParser();
  var xml=doc.parseFromString(xmltxt,"text/xml");
  if (xml.documentElement.nodeName=="parsererror")
      {
      document.write("Error in XML&lt;br&gt;&lt;br&gt;" + xml.documentElement.childNodes[0].nodeValue);
      alert("Error in XML\n\n" + xml.documentElement.childNodes[0].nodeValue);
      return false;
      }
  // XSL:
  var xsltPrs=new XSLTProcessor();
  var xsltxt
  xsltxt=document.getElementById("xsltcode").value
  if (xsltxt=="")
      {
      alert("The XSLT is empty")
      return false
      }
  xsl=doc.parseFromString(xsltxt,"text/xml");
  if (xsl.documentElement.nodeName=="parsererror")
      {
      document.write("Error in XSLT&lt;br&gt;&lt;br&gt;" + xsl.documentElement.childNodes[0].nodeValue);      
      alert("Error in XSLT\n\n" + xsl.documentElement.childNodes[0].nodeValue);
      return false;
      }
  
  xsltPrs.importStylesheet(xsl);
  
  // Transform:
  var result=xsltPrs.transformToFragment(xml,document);
  document.getElementById("result_output").appendChild(result);
   // document.replaceChild(result,window.document.childNodes[0])
    }
     else
    {
  // No Browser support:
  alert("Your browser does not support this example.");
      }
     } 
    &lt;/script&gt;
  </code></pre>
  
  <p>Thanks</p>
  
  <p>EDIT</p>
  
  <p>Marcus Rickert -
  "You need to replace</p>
  
  <pre><code>  &lt;xsl:value-of select="link"/&gt;
  </code></pre>
  
  <p>by</p>
  
  <pre><code>  &lt;xsl:copy-of select="link/*"/&gt;
  </code></pre>
  
  <p>since the former will only copy a text representation of the selected sub tree to your target        document. All tags will be lost. The latter will make a copy of your link tag. I've added a /* to make sure that the  tags themselves will not show up in the HTML. Most likely, they will be ignored but they are not required either."</p>