Hi Sir,
Sorry for the late reply.
What I want to do here is very simple. I create a textbox and user will input the text into the textbox and click on the check button. And in the javascript it will go through the xml file and look through the ID that the user just type in to see if it exists.
I have put my xml code and xsl code in this post. Please have a look. Thanks
This is my xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type = "text/xsl" href = "test2.xsl"?>
<xml>
<book>
<ID>book1</ID>
<price>5.00</price>
</book>
<book>
<ID>book2</ID>
<price>10.00</price>
</book>
</xml>
==============================================
This is my xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:template match="xml">
<html>
<head>
<script type = "text/javascript">
function check()
{
var itemID = document.getElementById("aID").value;
alert(itemID);
<xsl:variable name="id">itemID</xsl:variable>
// The following is what I want to do after set xsl variable with Javascript
<xsl:for-each select = "book">
<xsl:if test="ID=$id">
alert("Book ID exist");
</xsl:if>
</xsl:for-each>
}
</script>
<title> XSL Example </title>
</head>
<body>
<input type = "text" name = "aID" id = "aID" value = "" />
<input type = "button" value = "Check" onClick = "check()" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
================================================== =======
I just want to transform it into xsl using the xml file.
Sorry I am not sure about the platform that you mention. I am using IE to run all this stuff.
Please let me know if you requires any more information.
Thanks a lot.