Keys
- advanced node IDs
a key is a triple (node, name, value)
- <xsl:key match="pattern" name="..." use="node set expression"/>
- declares set of keys - one for each node matching the pattern
and for each node in the node set
Comparison to DTD (or DSD) IDs:
- keys are declared in the stylesheet (not in the DTD)
- keys allow different "name spaces"
- key values can be placed anywhere (not just as attributes)
- one node may have several keys
- keys need not be unique
Extra XPath key functions:
- key(name expression, value expression)
- returns nodes with given key name and value
- key(name expression, node-set expression)
- returns union of key(name, string value of
node) for each node in node-set
These are often used together with:
- generate-id(singleton node-set expression)
- returns unique string identifying the given node