Skip to content

SaveXML

Saves an element/attribute structure to be used in the next publisher run. The contents must have a tree structure.

Child elements

Element, ForAll, Loop, Value

Parent elements

AtPageCreation, AtPageShipout, Case, Contents, ForAll, Function, Loop, Otherwise, Record, Template, Until, While

Attributes

attributes (XPath expressions, optional)
A sequence of attributes (created with Attribute) that is set on the root element. Example: $attributesvar
elementname (text)
Name of the root element that surrounds the elements given by the child elements.
href (text, optional)
Name of the file. Example: toc.xml
name (text, optional)
Name of the file. Example: toc
select (XPath expressions, optional)
Alternative to giving the data structure in the child elements.

Example

  <Record match="data">
    <SetVariable variable="attributesvar">
      <Attribute name="att1" select="'Hello'" />
      <Attribute name="att2" select="123" />
    </SetVariable>

    <SaveXML name="toc" elementname="root" attributes="$attributesvar">
      <Element name="child">
        <Attribute name="attchild" select="999"/>
      </Element>
    </SaveXML>
  </Record>

This code saves an XML file to the disc which has this structure:

<root att1="Hello" att2="123">
 <child attchild="999"/>
</root>
<SaveXML name="toc" elementname="Contents">
  <Value select="$contents"/>
</SaveXML>

is equivalent to

<SaveXML name="toc" elementname="Contents" select="$contents"/>

See also