#parse ( "templates.vm" ) #macro(document) #header() #set($allSections = $root.getChild("body").getChildren("section")) #foreach( $section in $allSections ) #section ($section) #end #footer() #end #macro ( subsection $subsection)
#if ( $subsection.getAttributeValue("anchor") ) #set ($anchor = $subsection.getAttributeValue("anchor")) #else #set ($anchor = $subsection.getAttributeValue("name")) #end

$subsection.getAttributeValue("name")

#foreach ( $items in $subsection.getChildren() ) #copy($items) #end
#end #macro (section $section)
#if ( $section.getAttributeValue("anchor") ) #set ($anchor = $section.getAttributeValue("anchor")) #else #set ($anchor = $section.getAttributeValue("name")) #end

$section.getAttributeValue("name")

#foreach ( $items in $section.getChildren() ) #if ($items.getName().equals("subsection")) #subsection ($items) #else #copy($items) #end #end
#end #parse ( "templates.vm" ) #document()