this is my xml format :-
<products>
<product_id value="nokia">
<tab_id value="3550">
<individual_born_from value="1990-03-20"/>
</tab_id>
<products_id>
<product_id value="samsung">
<tab_id value="3650">
<individual_born_from value="1990-03-20"/>
</tab_id>
<products_id>
</products>
my code:-
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
var xml;
$.get(
"xml_converted.xml",
null,
function (data) {
xml = data;
},
"xml"
);
function get_list() {
var elName = $('#select').val();
var xPath = '//product_id["' + elName + '" ' +
' < translate(tab_id/individual_born_from/@value,"-","")]/@value';
var iterator = xml.evaluate(xPath, xml.documentElement, null,
XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
var thisNode = iterator.iterateNext();
var str = '';
while (thisNode) {
if (str) {
str += ', ';
}
str += thisNode.textContent;
thisNode = iterator.iterateNext();
}
$("#result").text(str);
}
</script>
</head>
<body>
<input type="text" id="select">
<input type="button" name="button" value="Search" onclick="get_list()">
<div id="result">
</div>
</body>
</html>
this is my xpath:-
var xPath = '//product_id["' + elName + '" ' +
' < translate(tab_id/individual_born_from/@value,"-","")]/@value';
here i want to output something like:-
if user enter date in textbox
if textbox value less-than xml individual_born_from="1990-03-20"
then display output :- 1,2
b'coz of 1 is first <product_id>
attr value and 2 is second level <prodcut_id>
attr value both date are grater-than entered by user in textbox...
if possible with php code using xpath then also help me i add tag PHP
thanks