Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL Pattern vs. XPath

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 11/17/2009 12:15:00 PM
Richard M. Hartman wrote:
> Trying to figure out selectSingleNode().  The query syntax can be either 
> "XPath" or "XSL Pattern".  Not finding any good comparisons of the two 
> syntaxes.  What I really want to know is if you can do a case-insensitive 
> search with selectSingleNode() ... so far it seems to be case sensitive.

XPath 1.0 is a W3C standard since 1999, consider to use that. It is the 
only option available with MSXML 4, 5, 6 anyway.
Only MSXML 3 supports both XPath and XSL pattern but I don't think 
Microsoft has any documentation of that XSL pattern language which was 
implemented before XPath became a standard in 1999.

As for case-insensitive search, element and attribute names in XML are 
case sensitive, so XPath is too when it comes to element and attribute 
names. If you want to compare string values in a case insensitive manner 
then the extension function ms:string-compare
http://msdn.microsoft.com/en-us/library/ms256114.aspx
has an option to do that. It should be supported in MSXML 6:

var doc = new ActiveXObject('Msxml2.DOMDocument.6.0');
doc.loadXML('<root><foo>bar</foo><foo>BAR</foo><foo>baz</foo></root>');
doc.setProperty('SelectionLanguage', 'XPath');
doc.setProperty('SelectionNamespaces', 
'xmlns:ms="urn:schemas-microsoft-com:xslt"');
doc.selectNodes('root/foo[ms:string-compare(., "bar", "", "i") = 0]').length


-- 

	Martin Honnen --- MVP XML
	http://msmvps.com/blogs/martin_honnen/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent