Adding a Default Attribute to a Document

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 28 Feb 2007


A Forum reader recently asked:

"After doing a source query, you get an "Instance" document back. How can I add a default attribute to this document? I think I need to use do-append-xml-text or element, but I have not found any examples of this."

And here's the response from Father Ramon ...


Try this:

  <description>add default attribute to instance</description>
    <if-operation mode="case" op="equal">instance</if-operation>
    <if-class-name mode="nocase" op="equal">User</if-class-name>
   <do-append-xml-element expression="." name="attr"/>
   <do-set-xml-attr expression="attr[last()]" name="attr-name">
   <do-append-xml-element expression="attr[last()]" name="value"/>
   <do-append-xml-text expression="attr[last()]/value[last()]">
     <token-text>the value of the attribute</token-text>

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© Micro Focus