R
RC
Let's say:
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200)
{
// Now I got an XML object here
var xmlDocument = XMLHttpRequestObject.responseXML;
// next I have dealing with XML file tags used DOM.
var options = xmlDocument.getElementsByTagNameNS(null,"myXMLTag");
doMyFunctionWithHTMLDOM(options);
}
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="myXSLTFile.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>NY</state_code>
<state_code>NJ</state_code>
<state_code>NM</state_code>
<state_code>NC</state_code>
<state_code>NH</state_code>
</states>
------------XSLT-----------------------------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput method="html" />
<xsl:template match="states">
<form>
<select>
<xsl:apply-templates select="state_code" />
</select>
</form>
</xsl:template>
<xsl:template match="state_code">
<option value="{text()}">
<xsl:value-of select="text()" />
</option>
</xsl:template>
</xsl:stylesheet>
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200)
{
// Now I got an XML object here
var xmlDocument = XMLHttpRequestObject.responseXML;
// next I have dealing with XML file tags used DOM.
var options = xmlDocument.getElementsByTagNameNS(null,"myXMLTag");
doMyFunctionWithHTMLDOM(options);
}
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="myXSLTFile.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>NY</state_code>
<state_code>NJ</state_code>
<state_code>NM</state_code>
<state_code>NC</state_code>
<state_code>NH</state_code>
</states>
------------XSLT-----------------------------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput method="html" />
<xsl:template match="states">
<form>
<select>
<xsl:apply-templates select="state_code" />
</select>
</form>
</xsl:template>
<xsl:template match="state_code">
<option value="{text()}">
<xsl:value-of select="text()" />
</option>
</xsl:template>
</xsl:stylesheet>