
Sample COSES files
==================

<!--
 !
 !  This example will dump every single string passed into it. For
 !  example, if you pass it a hash with one item 'data' containing two
 !  items 'a' and 'b' with 'a' containing 'hello' and 'b' containing
 !  an array of two values 'wonderful' and 'world', you would get as
 !  output the following:
 !
 !     data.a = hello
 !     data.b.1 = wonderful
 !     data.b.2 = world
 !
 !  This example uses almost all the features of COSES, and so is
 !  quite a useful example to study. (It doesn't use <else/> or all
 !  the values of <set>'s attributes.) It's also a great help when
 !  debugging! You can use it at any point in a COSES document merely
 !  by nesting it, so you can, for example, study what is happening
 !  with a <set> statement. If you declare this example as having the
 !  name 'debug.dumpVars' then to embed it you would do:
 !
 !     <embed string="debug.dumpVars"/>
 !
 !  This example is covered by the same license terms as COSES itself.
 !  Author: Ian Hickson
 !
 !-->
<text xml:space="default"> <!-- trim whitespace -->
  <with variable="prefix">  
    <if lvalue="((prefix))" condition="is" rvalue="scalar">
      <text value="  (prefix)"/> = <text value="((prefix))"/><br/>
    </if>
    <if lvalue="((prefix))" condition="is not" rvalue="scalar">
      <set variable="index" value="((prefix))" source="keys" order="case insensitive lexical">
        <set variable="prefix" value="(prefix).(index)">
          <embed string="debug.dumpVars"/>
        </set>
      </set>
    </if>
  </with>
  <without variable="prefix">
    <set variable="prefix" value="()" source="keys" order="lexical">
      <embed string="debug.dumpVars"/>
    </set>
  </without>
</text>
