Attribute contexts

It is possible to select elements that have a particular attribute declared, or that have a given value for this attribute. Attribute names are distinguished from element names using an '@' prefix. While 'x' could be an element name, '@x' would be a quite separate attribute name. To specify that a particular attribute must be present, it is necessary to include the attribute name in the predicate filter:

match="X[@A]"

There is one complication that may arise when a DTD is referenced by the XML document being processed. The DTD defines the attributes which may be used with each element, and in some cases it provides a default ...

Get XSL companion, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.