Jump to content

AhtUrghan

Members
  • Posts

    2
  • Joined

  • Last visited

AhtUrghan's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. 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?
  2. XML File: <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE organization [ <!ELEMENT organization (department+)> <!ELEMENT department (#PCDATA)> <!ATTLIST department id ID #REQUIRED> ]><organization> <department id="BOB Programs">BOB Programs</department> <department id="LME">LME Programs</department></organization> Web Page: <html><head><script type="text/javascript"for="window" event="onload"> var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.load("org.xml");<!-- //Error Occurs on following line --> var nodes = xmlDoc.documentElement.getElementById("LME"); if(nodes==null) { department.innerText="Screw It"; } else { department.innerText = nodes(0).text; }</script></head><body><b>Department Name:</b><span id="department"> </span><br/></body></HTML> Using IE6. I get the error: Object doesnt support this property or method at the indicated line.I know I'm doing something simple wrong, what is it?
×
×
  • Create New...