Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script>
- function loadXMLDoc(dname)
- {
- if (window.XMLHttpRequest)
- {
- xhttp=new XMLHttpRequest();
- }
- else
- {
- xhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xhttp.open("GET",dname,false);
- xhttp.send("");
- return xhttp.responseXML;
- }
- function displayResult()
- {
- xml=loadXMLDoc("f.xml");
- xsl=loadXMLDoc("xsl.xsl");
- // code for IE
- if (window.ActiveXObject)
- {
- ex=xml.transformNode(xsl);
- document.getElementById("example").innerHTML=ex;
- }
- // code for Mozilla, Firefox, Opera, etc.
- else if (document.implementation && document.implementation.createDocument)
- {
- xsltProcessor=new XSLTProcessor();
- xsltProcessor.importStylesheet(xsl);
- xsltProcessor.setParameter(null, "testParam", "voo");
- // alert(xsltProcessor.getParameter(null,"voc"));
- document.getElementById("example").innerHTML = "";
- resultDocument = xsltProcessor.transformToFragment(xml,document);
- document.getElementById("example").appendChild(resultDocument);
- }
- }
- </script>
- </head>
- <body onload="displayResult()">
- <li><u><a onclick="displayResult();" style="cursor: pointer;">test1</a></u></li>
- <div id="example" />
- </body>
- </html>
- <?xml version="1.0" encoding="UTF-8"?>
- <?xml-stylesheet type="text/xsl" href="vocaroos.xsl"?>
- <test>
- <artist name="Bert">
- <voo>bert1</voo>
- </artist>
- <artist name="Pet">
- <voo>pet1</voo>
- </artist>
- </test>
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:param name="testParam"/>
- <xsl:template match="/">
- <html>
- <body >
- <h2>Titleee</h2>
- <table border="1">
- <tr bgcolor="#9acd32">
- <th>Teeeeeest</th>
- </tr>
- <xsl:for-each select="test/artist">
- <tr>
- <td><xsl:value-of select="$testParam"/></td>
- </tr>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
- <xsl:value-of select="$testParam"/>
- <xsl:value-of select="voo"/> (right outcome)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement