This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
XPath is often used to access HTML documents rather than XML documents. HTML5 names allows characters that are not allowed in XML names (for example, '$' is allowed in attribute names, and attribute names can start with a digit). At present the only way to reference such attributes is with the circumlocution *[local-name()='$name'] (and even this requires a violation of contraints in the XDM specification). It would be useful to have a defined way to perform queries on XDM instances that aren't constrained by the XML rules on valid element and attribute names. This would also make it easier to map other data models to XDM. I would therefore propose that (a) XDM should allow, perhaps in some kind of "non-XML mode", arbitrary strings to appear as element and attribute (local) names (b) XPath should have some kind of escape mechanism to allow searching for such names. One possibility would be enclosing the string in backticks, e.g. @`$name` Another would be to allow character references to be used in names (which of course would need to be double-escaped when XPath is embedded in XML): @$name Another would be to adapt the EQName syntax: N{$name}. There are other situations where escaped names would be useful: for example calling out to functions in a different programming language, or referencing JSON keys.