Simply put, I'd like all of the paths below to evaluate to the same values:
- /root/item1/text()
- /ROOT/ITEM1/text()
- /Root/Item1/text()
As I understand it, the idea is that XML nodes with different case are actually treated as different. The problem here is that I am building a dynamic XML builder based on a set of relational SQL DB tables. This application will be installed on over 50 different servers with their own SQL instances. 50% of the tables structure, names, and types will differ, while, the other 50% COULD vary in the letter case of the name. The goal is to apply standard XQuery transformations to these dynamically generated XML files that have a custom AND standard section, standard meaning that it applies to ALL 50+ servers. This is why I am looking for case-insensitive path logic, even though it goes against the fundamentals of XML, it would provide a HUGE benefit for our use case to "opt" in to an ability like this.
A useful workaround I have in place at the moment for testing is doing a pre-transformation using an XSLT to convert ALL element node names to lowercase. So if nothing comes out of this, then at least it will still be workable enough.
I'm new to XQuery/XPath/XSLT, so namespaces are still a strange concept to me. One thing I stumbled upon was declaring a collation. However I can't tell if that is just for typical string comparisons ($x = $y) or other such things. Saxon has a built in method of it's processor called Processor.DeclareCollation(), I attempted to use it, however I didn't notice the queries running any differently.
Is collation my answer and just a matter of how to set it up (never really messed with it prior to this)? Is there another way to go about this? Or should I stick with the solution I have in place?
*P.S. Having case-insensitive function names would be an awesome bonus too [text() vs TEXT()] BUT I can live without that, just would be helpful for the nooblets on my team to experience less errors. :)
@match
and@select
XPaths to be lower-case()... – Mads Hansen