<wmmeta name="Title" value="The <attrdefault> Tag" />
<wmmeta name="Section" value="05-meta" />
<wmmeta name="Score" value="45" />
<wmmeta name="Abstract">
Specify default attributes for content items
</wmmeta>
Attributes are usually specified inside a content item's "<content>"
[content] or "<contents>" [contents] tags, or, for output files, inside
the "<out>" [out] tag. However, this can be a chore if you have many
items to set attributes on, so, to make things easier, you can specify default
attributes using the <attrdefault> tag.
Specify this tag before the content items or output files in question, and
those items will all be tagged with the attributes you set.
Like the metadefault [metadefault] tag, this tag can be used either in a
__scoped__ mode, or in a __command__ mode.
[metadefault]: $(metadefault)
Scoped Mode
~~~~~~~~~~~
''Scoped'' mode uses opening (**<attrdefault>**) and closing
(**</attrdefault>**) tags; the attributes are only set on content items
or output files between the two tags.
__Note!__ one warning about ''scoped'' mode: note that WebMake does not use
a fully-correct XML parser to parse the XML in the .wmk file, so if you nest
<attrdefault> tags, it will not correctly parse them; instead, the
first closing **</attrdefault>** tag found will be used.
Command Mode
~~~~~~~~~~~~
Command mode uses standalone tags (**<attrdefault ... />**); the
attributes are set until the end of the WebMake file, or until you change
them with another <attrdefault> tag.
Attributes
==========
__name__: the attribute's name, e.g. __up__, __map__,
etc. This is required.
__value__: the attribute's value. This is optional. If the
value is not specified, the attribute will be removed from the list of
default attributes.
[content]: $(content)
[contents]: $(contents)
[out]: $(out)
Example
=======
Using the scoped style:
<safe>
<attrdefault name="format" value="text/html">
<content name="chunk_1.txt">...</content>
<content name="chunk_2.txt">...</content>
<content name="chunk_3.txt">...</content>
<content name="chunk_4.txt">...</content>
</attrdefault>
</safe>
Or, in the ''command'' style:
<safe>
<attrdefault name="format" value="text/html" />
<content name="chunk_1.txt">...</content>
<content name="chunk_2.txt">...</content>
<content name="chunk_3.txt">...</content>
<content name="chunk_4.txt">...</content>
<attrdefault name="format" />
</safe>