I guess I can take this as a suggestion that it would be worth it to implement this, right? :-)
You mean if the data look like this:
? You could use a template like this for example:[ { 'lname' => 'Krynicky', 'fname' => 'Jenda', 'PageId' => 1, 'Details' => { Header => 'blah blah', Footer => 'bla bla bla', } }, ... ];
<root> <page cmd:foreach set:id="$_->{PageId}" opt:required> <field cmd:foreachkey="! /^(PageId|Details)$/"> <cmd:insert set:_tag="$key" set:_content="$value"/> </field> <details cmd:forkey="Details"> <cmd:insert cmd:foreachkey set:_tag="$key" set:_content="$value"/ +> </details> </page> </root>
That is you make sure the foreachkey in the <field> tag skips both the PageId and Details keys, include the <details> tag to present the values of the 'Details' key and finally foreachkey directly in the <cmd:insert> tag to print the data from the inner hash.
Is this what you meant? I assume writing the documentation for this will be quite hard. Just like the docs for XML::Rules were. And I don't think I did a perfect job there.
In reply to Re^2: Datastructures to XML
by Jenda
in thread Datastructures to XML
by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |