AhtUrghan Posted June 8, 2006 Share Posted June 8, 2006 I have a javascript header that moves to the bottom of the page when I filter my xml file.I'm new to xml & xslt, so I'm not sure why this behavior is occuring. A simple example of the problem is:Filter:function filter(idx){ try{ alert(idx); var s = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); var x = document.XMLDocument; if (x == null){ x = navigator.XMLDocument; s.loadXML(navigator.XSLDocument.xml); }else{ s.loadXML(document.XSLDocument.xml); } var tem = new ActiveXObject("MSXML2.XSLTemplate"); tem.stylesheet = s; var proc = tem.createProcessor(); proc.addParameter("idx", idx); proc.input = x; proc.transform(); var str = proc.output; var newDoc = document.open("text/html"); newDoc.write(str); navigator.XMLDocument = x; navigator.XSLDocument = s; newDoc.close(); }catch(exception){ }}XSL<?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="idx" select="1" /><xsl:template name="department" match="/"> <html> <head> <script language="javascript" src="filter.js"></script> <script src='topnav.js'></script> </head> <body> <h2>Our Departments</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Department</th> <th align="left">ID</th> </tr> <xsl:for-each select="organization//department[id=$idx]//department"> <tr> <td> <xsl:attribute name="onclick">filter(<xsl:value-of select="id" />);</xsl:attribute> <u><xsl:value-of select="title" /></u> </td> <td><xsl:value-of select="id"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>XML:<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="org.xsl"?><organization> <department> <title>BTTD</title> <id>1</id> <department> <title>BME</title> <id>2</id> </department> <department> <title>BNTPROG</title> <id>3</id> <department> <title>Jim Quagmire</title> <id>4</id> </department> </department> </department></organization>Thanks in advance for your reply!How can I get the header to stay at the top? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now