Implements the "mxsl" subset/dialect of XSLT used for compiled XML templates.
This template language is used in the -xml_record()
attribute
provided by xmlrat_parse_transform
.
The MXSL language is designed to look and feel a lot like XSLT, but with some modifications (due to the fact that the input data is Erlang records and not XML/XPath), and some abbreviations to make templates easier to read and write.
As well as the normal XSLT-style use of namespaced elements to substitute
values (e.g. <mxsl:value-of field='...'/>
), MXSL also
supports using XML entities named after each record field for substitution.
<KeyInfo>
<mxsl:if defined='name'>
<KeyName><mxsl:value-of field='name'/></KeyName>
</mxsl:if>
<KeyType Algorithm='&algorithm;'/>
</KeyInfo>
The mxsl:
namespace URI is
https://cooperi.net/xmlrat/mini-xslt/
. Templates can either
use the pre-defined namespace prefix mxsl:
, or define their
own in the regular way using xmlns:*
attributes.
Substitutes with the value of a record field. The mxsl:value-of
element will be deleted, replaced with the record field's type-coerced value.
field
: specifies the name of the record field to
substituteAdds an attribute to the parent element, with the new attribute's value
set by a record field. Can also be nested inside a
<mxsl:if>
element (will add the attribute to the
grandparent).
name
: specifies the name of the attribute to addnamespace
: specifies the namespace prefix of the
attribute (optional)field
: specifies the name of the record field whose value
will placed in the attributeConditionally applies or includes some elements if a record field is
set to a value other than undefined
, or set to boolean
true
.
defined
: specifies the record field whose value will
checked for undefined
true
: specifies the record field whose value will be
checked for boolean true
<mxsl:attribute>
Repeats a sub-tree of the document once for each element in a list. The
current element is bound as a "fake" record field (and can be referenced
by either <mxsl:value-of>
etc or entities).
field
: specifies the name of the record field whose value
will be iterated overas
: specifies the name of the pseudo-field which will be
bound to each individual element in the listGenerates an element with a dynamic tag name based on a record field.
Attributes:mxsl:field
: specifies the record field whose contents will
be used to rename this tag.The mxsl:field
attribute will be elided from the output, but
all other attributes of the tag will be inherited by the final output tag.
Within any element content or attribute value, entities may be used to refer
to the value of record fields. The entity name matches the record field
name exactly: e.g. &foobar;
refers to the value of record
field foobar
.
undefined
, and the attribute value consists only of the field
entity, the entire attribute will be elided from the output.
Generated by EDoc