RenderXML templates

Introduction

In this section, we describe some commands that are available only in RenderXML mode.

Basic emitting commands

  • {{ attrib identifier }}: Emits the contents of the attribute named by the "identifier", within a "renderinfo" stylesheet, mangling any characters that need XML mangling.

  • {{ attribnomangle identifier }}: Emits the contents of the attribute named by the "identifier", within a "renderinfo" stylesheet, without XML mangling.

  • {{ copyattribs }}: Copy all attribute names and their values into the output, as though copying the element's attributes into a new XML document. That is, each copied attribute follows the pattern ' attribname="attribvalue"', mangling any characters in the attribvalue that need XML mangling. This can only be used in a renderinfo stylesheet, not a fetchinfo stylesheet.

Variable manipulation commands

  • {{ setvar output-variable-name-as-string substring attrib input-attrib-name-as-string from start-index-as-integer maxlength max-length-to-copy-as-integer }}

    {{ setvar output-variable-name-as-string substring attribnomangle input-attrib-name-as-string from start-index-as-integer maxlength max-length-to-copy-as-integer }}

    Sets the string contents of a variable with the name given in output-variable-name-as-string to a substring of the contents of the attribute with the name given in input-attrib-name-as-string. If the output variable does not exist, it is created.

    If the token after 'substring' is 'attrib', then the attribute is mangled for XML-entities before being considered for substring extraction. If the token after 'substring' is 'attribnomangle', then the contents of the attribute are considered as-is.

    The subtring taken is the one starting at the index start-index-as-integer, and ending at the end of the input variable, or the index just before start-index-as-integer + max-length-to-copy-as-integer, whichever comes first.

    If the integer start-index-as-integer is negative, then the starting index is calculated as starting from the end of the string. For example, -1 will be the last byte in the string.

    NOTE: The indexes are byte-counts, not Unicode characters. This may limit the utility of this template in the context of non-ASCII character sets.


Previous:RenderXML
Up:RenderXML
Next:RenderXML stylesheet inheritance