|
|||||||||
|
|
|||||||||
| Entity attributes | |||||||||
In SGML, attributes may be of type entity or entities. Retrieving the data associated with an entity that is the value of an attribute is similar to retrieving the value of a regular entity, except that you must do so in an element rule instead of an external text or data entity rule.
This has the following consequences:
is entity (or is entities) test.
is external (or is internal) test, and act accordingly.
"%pv" and "%ev" instead of "%pq" and "%eq" to access the PUBLIC and SYSTEM identifiers. For an internal entity, you can use the format item "%ev" to access the replacement value of the attribute.
entity is in-library test is not available, so you must use the test #library has key "%pv(attribute-name)" instead.
declare catch entity-replacement-found
element "foo"
repeat over attributes as this-attribute
do when attribute this-attribute is entity
do when attribute this-attribute is external
do when #library has key "%pv(baz)"
do when file #library{"%pv(baz)"} exists
output file #library{"%pv(baz)"}
else
repeat over #libpath
do when file (#libpath || #library{"%pv(baz)"}) exists
output file (#libpath || #library{"%pv(baz)"})
throw entity-replacement-found
done
again
done
else
do when file "%ev(baz)" exists
output file "%ev(baz)"
throw entity-replacement-found
done
done
output ""
catch entity-replacement-found
else ;it is an internal entity
output "%ev(this-attribute)" ; output its replacement text
done
done
again
output "%c"
| ---- |