ajaxslt unable to get node using XPATH

bhowana

New Member
I am using the ajaxslt javascript library.(http://code.google.com/p/ajaxslt/) I am trying to get the node using XPATHMy XML is as follows:\[code\] <page> <message> Hello World. </message> </page>\[/code\]I am trying to use //page so that I can all nodes below page i.e. message node. When i try to print the same. I am getting only Hello World as output.Following is the code snippet i used.\[code\]<script src="http://stackoverflow.com/questions/11974329/js/xpath.js" language="JavaScript"></script><script src="http://stackoverflow.com/questions/11974329/js/xpath_script.js" language="JavaScript"></script><script type="text/javascript">\[/code\]\[code\]function showMessage(){ var xml = document.getElementById('xml'); var ctx = new ExprContext(xmlParse(xml.value)); var expr = xpathParse("//page"); var result = expr.evaluate(ctx); alert("res:"+result.stringValue());}\[/code\]Can anybody tell me what i am doing wrong here?Thanks in advance.Saravanan K
 
Top