Dynamic Attributes
The attributes for the pattern template tags are usually constant values, but there is the ability to accept dynamic values. You specify a dynamic attribute by inserting a dynamic expression, bracketed by percent signs, anywhere in a generator tag attribute. You can insert as many of these expressions as you want in a single attribute.
Dynamic Expression Syntax
The syntax of a dynamic expression (bracketed by percent signs ('%') is an extension of the node attribute syntax:
- The expression begins with either a forward slash (to indicate the document root of the input XML) or the name of an element (as defined in a useNode or iterate tag) in the input XML.
- A child of the indicated node can be specified by adding the element name of the child and any number of attribute filters, separated by blanks. In addition to the simple name='value' syntax, you may specify the filter as a negation (name!='value') or as an existence test (name=* if there's any value specified or name!=* if there's no attribute specified). Note the use of single quotes around the values.
- The parent of the indicated node can be specified by a double period ("..").
- Successive children or parents can be specified, using a forward slash as a delimiter.
The result of this expression must be an attribute or the content of a single node. For example:
- %type(length)% refers to the value of the length attribute of the node associated with name "type"
- %/doc/chapter id='3'(title)% refers to the title attribute of the <chapter> node with id of "3".
- %/team/member name='Chris'/jobdesc% refers to the content of the jobdesc node for the member element whose name attribute is "Chris".
© Copyright IBM Corporation 2000,
2005. All Rights Reserved.