Difference of Getting DOM ElementsM Between IE6 & FF2

Considering the following piece of XSLT
<xsl:template match="/uo_content/attractions/ride"> ...</xsl:template>
How about if we want to get the "template" element from this document?
var template = doc.getElementByTagName("xsl:template")[0]  // <--It does work, but only for IE
var template = doc.getElementByTagName("template")[0]  // <-- Firefox only
var template = doc.getElementByTagName("xsl:template")[0]  || doc.getElementByTagName("template")[0]  //<-- Both
Consider that "xsl" is a namespace but not a part of the tag name, I think Firefox way is better.(Tested in IE6 and FF2)

你可能感兴趣的:(element)