Naming nodes
Whether by necessity or for convenience, there will be places in your pattern templates where it is helpful to be able to associate a name with a specific node and then reference that node later using the name. Nodes with an associated name can be used as the start for for a search string in a node or nodes attribute, making access to the node's attributes and content more flexible in specification.
There are several pattern template tags that associate a name with a specific node:
- The iterate tag processes its content once for each node matching the search string. To make the current node of the iteration accessable during that iteration, the name attribute is used to specify the name to associate with the current node. This association is made at the begining of each iteration.
- The useNode tag lets you specify a search string that results in a single node and then associates the specified name with that node.
- The newNode tag creates a new child node in the parse tree for the input XML (application definition). Although you can specify the element name of that child node and use that name in subsequent searches, that technique does not work when you add mulitple child nodes with the same eement name. The useName attribute lets you associate a different name with each node.
- The extend tag reads in another XML document, parses it and makes it available for use with subsequent pattern template tags. Use the name attribute to specify the name to be associated with the document node of that XML. Note that the high-level node in the XML document is a child of the node with which the name is associated.
© Copyright IBM Corporation 2000,
2005. All Rights Reserved.