When you add a repository item using the <add-item>
tag, you can use the tag
attribute in place of the id
attribute. If you use a tag
attribute, the SQL repository chooses a unique repository ID for the item using the IdGenerator
and associates that tag with that ID. You can then refer to that particular tag name within that .XML file, using a tag
attribute. In the alternative, you can refer to the tag using this special syntax:
$tag:<
name
>$
The $tag:<
name
>$
syntax can be used only in:
the
value
attribute or body of a<set-value>
tagthe
query
attribute or the body of a<query-items>
tag
The template parser substitutes the ID of the item you created using that tag.
For example, suppose you want to add an item, one of whose properties is another repository item. Let’s say we are adding a book
item, and the book
item has a author
property, which is itself a repository item. If you don’t want to supply the repository ID for the author
repository item, you can use a tag
attribute placeholder like this:
<add-item item-descriptor="author" tag="AUTHORID_TAG">
<set-property name="authorName" value="Arthur Ransome"/>
...
</add-item>
<add-item item-descriptor="book">
<set-property name="title" value="Swallows & Amazons"/>
<set-property name="author" value="$tag:AUTHORID_TAG$"/>
</add-item>