The basic rule: attributes do not have an identifier at all - they are only available as side bits bound to a node . It’s good to think of them as non-existent until you have a node. You can also think of them as second-class citizens in the world of XPath and XSLT. Each time you use them in the selection conditions, you, as you switch from join to cursor in SQL, and every time you use "for" instead of "apply", this also happens.
Another way to express this is the only real, effective “index” that you have, one that has all the XPaths in the document (.Net actually creates a Hashtable from XPaths => constant time). The reason for “applying” the privilege is that it guarantees pure functional processing — you can run everything that corresponds to the application on separate threads without synchronization and without memory exchange — you simply agree with their results.
The third way to look at this, which is stretching, is to imagine that your tags are SQL tables, and that you only have surrogate PKs and FKs - you can’t choose anything else but “all of T1 and all related to them from T2. " For any worthy SQL engine, this seems like a 0-time effort to do this - it just reads one good index element by position, as its structure is 1-1 with your query. Everything else costs a lot more.
Once you have selected the tags and matched the templates and executed them, then it’s cheap for you to simply get the attribute values - for now, you just transform / render them. Attrib tests at the end of XPath are also quite cheap - again, since the last / node tag is selected, and now it just filters a little on top of it.
So, the XSLT engine and XPath choice generally have a very good reason to completely ignore attributes - perf.
Zxx
source share