Let's say:
if (XMLHttpRequest Object.readySta te == 4 &&
XMLHttpRequestO bject.status == 200)
{
// Now I got an XML object here
var xmlDocument = XMLHttpRequestO bject.responseX ML;
// next I have dealing with XML file tags used DOM.
var options = xmlDocument.get ElementsByTagNa meNS(null,"myXM LTag");
doMyFunctionWit hHTMLDOM(option s);
}
The problem is DOM requires you are an excellent JavaScript programmer
to deal with firstChild, lastChild, nextSibling, etc.
And 2nd problem is different browsers will have different results.
Sometime work in Firefox/Netscape, but not work in IE, etc.
In my XML file has a line
<?xml-stylesheet type="text/xsl" href="myXSLTFil e.xsl" ?>
I would like use a very simple XSLT file do the work, no DOM programming
deal with those "children".
So back to my question, How to use AJAX to deal with XSLT instead deal
with DOM?
Thank you very much in advance!
Here is an example of XML and XSLT files, they are working fine.
------------XML----------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<?xml-stylesheet type="text/xsl" href="test1.xsl " ?>
<states>
<state_code>N Y</state_code>
<state_code>N J</state_code>
<state_code>N M</state_code>
<state_code>N C</state_code>
<state_code>N H</state_code>
</states>
------------XSLT-----------------------------------------------
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" />
<xsl:template match="states">
<form>
<select>
<xsl:apply-templates select="state_c ode" />
</select>
</form>
</xsl:template>
<xsl:template match="state_co de">
<option value="{text()} ">
<xsl:value-of select="text()" />
</option>
</xsl:template>
</xsl:stylesheet>