attributes Full Description |
|
Syntaxspecified? attributes element-qualifier* Purpose The keyword To reference the attributes of a specific element, the element can be qualified in all of the same ways as attribute references. The The
For example, the following output action gives the value of the first attribute declared for the current element, no matter what its name or where its value is specified in a start tag. The following is an error if there are no attributes declared for the currently opened element, or if the first declared attribute doesn't have a specified (or defaulted) value:
output attributes item 1 In the following output action, however, the value of the first attribute specified in the start tag is output, no matter where it appears in the order of declarations. This action is an error if no attributes are specified in the start tag, even if there are declared attributes and they all have default values.
output specified attributes item 1 Applying the The number of attributes declared for an element can be determined by applying The following example shows how the output attribute this-one of element The following down-translate program uses the attributes shelf to add "id" attributes to elements that can have them:
down-translate global counter id-count element #implied output "<%q" do when attributes has key 'id' do when attribute id is cdata output " id='%q/%d(id-count)'" else output " id='%d(id-count)'" done increment id-count done output ">%c" output "</%q>" when element isnt empty |