Cernunnos Manual


${attributeNode()}

Description:

Creates a new XML attribute node from the specified TUPLE, which must contain an equals character ('=') to distinguish the name from the value of the attribute.

${attributeNode} is based on the dom4j API for XML. The attribute created by this phrase is an instance of org.dom4j.Attribute.

Reagents:

Name XPath Description Reagent Type Expected Type Required
TUPLE descendant-or-self::text() String expression that must provide both an attribute name and value. The first equals operator ('=') will be used as a separator; characters to the left will be used as the name of the attribute, characters to the right will be the value. PHRASE java.lang.String Yes

Examples:

Creates a new XML document containing '<example foo="bar"/>', then writes it to the file 'example.xml':

 
       
        <with-attribute key="Attributes.NODE" value="${newDoc(example)}"> 
          <append-node node="${attributeNode(foo=bar)}"/>  
          <write-document file="example.xml"/> 
        </with-attribute>