Specifying an Attribute Value for an Included Element
When you include an element, one of the options is to specify an attribute value. This option allows you to only include elements with a particular attribute/value pair. The attribute/value pair acts as a predicate on which to constrain the content. For example, consider the following XML snippet:
<chapter class="history">some text here</chapter> <chapter class="mathematics">some more text here</chapter> <chapter class="english">some other text here</chapter> <chapter class="history">some different text here</chapter> <chapter class="french">other text here</chapter> <chapter class="linguistics">still other text here</chapter>
For the element chapter
, if you specify the attribute/value pair of class
and history
, then only the following elements will be included:
<chapter class="history">some text here</chapter> <chapter class="history">some different text here</chapter>
You can only specify an attribute value for an included element; you cannot specify one for an excluded element.