There are two answers IMHO:
* First, a context allows the simplification of XPaths by enforcing an
if/then pattern with a shared if clause; as well, the context allows the
simplification of Xpaths because the form part of a case statement.
* Second, there is a distinction between the context (the XPath the
schema developer finds useful for expressing the assertion tests) and the
subject (the Xpath that corresponds to the information items that the
assertion text is about.) See s5.5.12 Subject attribute.
In the standard, you find
3.19 rule context
element or other information item used for assertion tests; a rule is said
to fire when an information item matches the rule context
3.22 subject
particular information item which corresponds to the object of interest of
the natural-language assertions and typically is matched by the context
expression of a rule
So "subject" points to the thing that humans may expect to be the item of
interest, while the "context" points to the item that is most convenient
for programmers to use. Usually they are the same, but not always.
For example, here is an artificial example:
<rule context="fred">
<assert test="(following-sibling::* | preceding-sibling::* | .)/@X">
At least one of the siblings of fred or itself should have an X attribute
</assert>
</rule>
might be clearer as
<rule context="fred/.." subject="fred">
<assert test="*[@X]">
At least one of the siblings of fred or itself should have an X attribute
</assert>
</rule>
The difference is not important, but I wanted to make sure that people
could refactor the XPaths in rules without breaking the use of <name/> and
<value-of/>
Cheers
Rick
-- DSDL comments To unsubscribe, please send a message with the command "unsubscribe" to dsdl-comment-request@dsdl.org (mailto:dsdl-comment-request@dsdl.org?Subject=unsubscribe)Received on Fri Aug 10 11:40:05 2007
This archive was generated by hypermail 2.1.8 : Fri Aug 10 2007 - 10:03:03 UTC