View Single Post
  #4 (permalink)  
Old November 2nd, 2006, 12:32 PM
mxxz mxxz is offline
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried this code sample and still have the same problem where the parameters are not appearing. Please help. I hard coded the parameter values in the HTML page and transforming in the HTML page. I think this is what you were saying in the answer. If you have a sample code I can try please advice.

xml----------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
  <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
  </cd>
   <cd>
    <title>zEmpire Burlesque</title>
    <artist>zBob Dylan</artist>
    <country>zUSA</country>
    <company>zColumbia</company>
    <price>10.90</price>
    <year>1985</year>
  </cd>

</catalog>

XLS-------------------------------------------------------

?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<xsl:param name="genre"/>
<xsl:param name="prodName"/>
  <html>
  <body>
    <h2>My CD Collection</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th align="left">Title</th>
        <th align="left">Artist</th>
      </tr>
      <xsl:for-each select="catalog/cd">
      <tr>
        <td><xsl:value-of select="title" /></td>
        <td><xsl:value-of select="artist" /></td>
      </tr>
      </xsl:for-each>
  </table>

  <table border="1">
      <tr bgcolor="#9acd32">
      <th align="left">Var</th>
      </tr>
      <tr>
      <td>
              <xsl:value-of select="$genre"/>
      </td></tr>
      <tr>
      <td>
              Test
      </td></tr>
      </table>
  </body>
  </html>
</xsl:template></xsl:stylesheet>


HTML-------------------------------------------------------

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <title></title>
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="author" content="Unregistered User">
  <meta name="generator" content="AceHTML Freeware">



<script language="javascript">
function loadData()
{

// Load XML
var xml = new ActiveXObject("MSXML2.DomDocument.3.0");
xml.async = false
xml.load("C:/Projects/Traders portal/test3.xml")

// Load the XSL
var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.3.0" );
xsl.async = false
xsl.load("C:/Projects/Traders portal/test3.xsl")


// Transform
//document.write(xml.transformNode(xsl))
var template = new ActiveXObject("MSXML2.XSLTemplate")
  template.stylesheet = xsl
  processor = template.createProcessor()

  processor.input = xml

  processor.addParameter("genre", 'Jazz')
  processor.addParameter("prodName", 'FRA')
  processor.transform()

  document.open()
  document.write(processor.output)
  document.close()
}

</script>
 <body id='updateTarget' onLoad="javascript:loadData()">

  </body>




Reply With Quote