c++ - XPATH backwards compatibility with XSLPattern -
c++ - XPATH backwards compatibility with XSLPattern -
it understanding xslpattern queries work identically xpath queries, not other way around. can confirm this, or have link microsoft documentation confirms this?
i have changed selection language of msxml documents xpath in various parts of code manage, , want create sure i'm not going break queries written xslpattern queries.
in understanding there expressions valid xslpattern
, executable selectnodes/selectsinglenode
throw error when beingness executed xpath 1.0
expression. instance example
var doc = new activexobject('msxml2.domdocument.3.0'); doc.loadxml('<root><item>1</item><item>2</item></root>'); var item = doc.selectsinglenode('root/item[end()]'); wscript.echo(item.xml); doc.setproperty('selectionlanguage', 'xpath'); item = doc.selectsinglenode('root/item[end()]');
makes utilize of the end()
function defined in xslpattern
language , such works fine long selection language xslpattern in lastly line throws exception there no such function in xpath 1.0, there write root/item[position() = last()]
.
so there xslpattern expressions don't work xpath 1.0 expressions. there expressions lead different result, instance
var doc = new activexobject('msxml2.domdocument.3.0'); doc.loadxml('<root><item>1</item><item>2</item><item>12</item></root>'); var look = 'root/item[. > "10"]'; var item = doc.selectsinglenode(expression); wscript.echo(item.xml); doc.setproperty('selectionlanguage', 'xpath'); item = doc.selectsinglenode(expression); wscript.echo(item.xml);
which outputs
<item>2</item> <item>12</item>
as seems xslpattern create string based >
greater comparing while xpath 1.0 supports number comparing , automatically converts arguments type.
c++ xml xpath msxml
Comments
Post a Comment