Subject: RE: Leventhal's challenge misses the point From: "Don Park" <donpark@xxxxxxxxx> Date: Sat, 29 May 1999 13:19:44 -0700 |
> Produce the DOM+ECMAScript version of the following... > > <xsl:template match="//section/title"> > <h1><xsl:value-of /></h1> > </xsl:template> > > Which *might* look like... > > var sections = xmlDoc.getElementsByTagName('section'); > for (var i = 0; i < sections.length; i++) { > var titles = sections[i].getElementsByTagName('title'); > for (var j = 0; j < titles.length; j++) { > document.write('<h1>'+titles[j].nodeValue+'</h1>'); > } > } DOM with query language support will look a little less busy: var result = xmlDoc.getElementsByQuery("//section/title"); for (var i = 0; i < result.length; i++) document.write("<h1>" + result[i].nodeValue + "</h1>"); Don XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Leventhal's challenge misses th, Guy Murphy | Thread | Re: Leventhal's challenge misses th, James Tauber |
Re: Leventhal's challenge misses th, Guy Murphy | Date | Re: Leventhal's challenge misses th, Paul Tchistopolskii |
Month |