Volleynerd Knowledge Base

Wednesday, November 13, 2002


XSLPattern vs XPath



MSXML parser has a SelectionLanguage property that you can set to specify whether the selectSingleNode and selectNodes methods use a particular syntax.

set the current query syntax with setProperty. Pass SelectionLanguage either "XPath" or "XSLPattern".
XSLPattern is the default for backward compatibility.

From my own testing with sample XSLT viewer, the major difference is:
XPath is 1-based in collections, XSLPatterns is 0-based

MSXML 3.0 help in MSDN seems to be inconsistent:
Here it says XPath is 0 based in the elements of a collection.
The following finds the first author element.

author[0]

Here it says XPath is 1 based.

For example, the following finds the first author element.
author[1]


This article talks about setting the above -- setting the default selection language.

XSLPattern apparently does not support functions such as count(), sum(), string-length(), etc.




Comments: Post a Comment

Home