5.2.3 Element/Attribute Names and XPath Notation
Prev | 5.2 Template Table Structure | Next

### 5.2.3 Element/Attribute Names and XPath Notation

The name of each XML element and attribute used in a CDA document for which specific constraints are applied is shown in the Element/Attribute column of the template tables. Optional elements whose use is not specified nor constrained are not shown.

Elements and attributes that use the default value specified in CDA Specification are not shown. For example, the Section element has default attributes classCode='DOCSECT' and moodCode='EVN'; these are not listed in the templates. In accordance with the HL7 v3 specification, attributes with default values need not be included in instances, and their absence implies the default value.

XML Path Language (XPath) notation is used to identify the XML elements and attributes within the CDA document instance to which various constraints are applied. The implicit context of these expressions is the root node of the document, and traversing the path to the root node of the relevant template. This notation provides a mechanism that will be familiar to developers for identifying parts of an XML document.

XPath syntax selects nodes from an XML document using a path containing the context of the node(s). The path is constructed from node names and attribute names (prefixed by a '@') and concatenated with a '/' symbol.

Example 5.2.3-1 is an example of a fragment of a CDA document.

Example 5.2.3-1. XML document example

    <author>
        <assignedAuthor>
            ...
            <code codeSystem='2.16.840.1.113883.6.96' codeSystemName='SNOMED CT'
                    code='17561000' displayName='Cardiologist' />
                ...
            </assignedAuthor>
        </author>

Table 5.2.3-1 is an example of a fragment of a template specification table.

Table 5.2.3-1. Template element and attribute example

… | Nest Level | Element/​Attribute | …
--- | --- | --- | ---
|  | author |
| > | assigned​Author |
… |  |  |
| >> | code |
| >>@ | @codeSystem |
| >>@ | @codeSystemName |
| >>@ | @code |
| >>@ | @displayName |
… |  |  |

In Table 5.2.3-1, the code attribute of the code element could be selected with the XPath expressionauthor/assignedAuthor/code/@code.

Prev | Up | Next
5.2.2 Nesting Level | Home | 5.2.4 Cardinality