## ## Content Stylesheet for Site ## ## Defined variables ## ## ## Start and end the processing ## #document() ## ## This is where the macros live ## #macro ( relativise $elem ) #if ($elem.getAttribute("href")) #set ($href = $elem.getAttributeValue("href")) #if ($href.startsWith("/")) #set ($elem = $elem.setAttribute("href", "$relativePath$href")) #end #end #if ($elem.getAttribute("src")) #set ($href = $elem.getAttributeValue("src")) #if ($href.startsWith("/")) #set ($elem = $elem.setAttribute("src", "$relativePath$href")) #end #end #end ## ## #macro ( color_table $table ) #set ($table = $table.setAttribute("class", "colortable")) #foreach ( $tw in $treeWalk.allElements($table) ) #if ($tw.getName().equals("trh")) #set ($tw = $tw.setAttribute("align", "left")) #set ($tw = $tw.setName("th")) #end #end #if (! $table.getAttributeValue("width")) #set ($table = $table.setAttribute("width", "100%")) #end $table #end ## ## #macro ( make_note $note)
$note
#end ## ## #macro ( make_toc ) #set ($allSections = $root.getChild("body").getChildren("section")) #end ## ## #macro ( metaauthor $author $email ) #end ## ## #macro ( metaatom $title $url ) #end ## ## #macro ( source $value )
$escape.getText($value.getText())
#end ## ## #macro ( section $section $level ) #if ($section.getChild("title")) #set ($heading = $section.getChildText("title")) #elseif ($section.getAttributeValue("id")) #set ($heading = $section.getAttributeValue("id")) #else #set ($heading = "") #end #if ($level == 1)

#if ($section.getAttributeValue("id")) $heading #else $heading #end

#elseif ($level == 2)

#if ($section.getAttributeValue("id")) $heading #else $heading #end

#elseif ($level == 3)

#if ($section.getAttributeValue("id")) $heading #else $heading #end

#else
#if ($section.getAttributeValue("id")) $heading #else $heading #end
#end
## First, walk the tree and relativise any absolute path URI references ##foreach ( $tw in $treeWalk.allElements($section) ) ##relativise ($tw) ##end ## Second, output the section-level children with transformers #foreach ( $items in $section.getChildren() ) #if ($items.getName().equals("source")) #source ($items) #elseif ($items.getName().equals("table")) #color_table ($items) #elseif ($items.getName().equals("note")) #make_note ($items) #elseif ($items.getName().equals("toc")) #make_toc () #elseif ($items.getName().equals("section")) ##set ($sublevel = $level + 1) #if ($level == 1) #section ($items 2) #elseif ($level == 2) #section ($items 3) #elseif ($level == 3) #section ($items 4) #else #section ($items 5) #end #elseif ($items.getName().equals("title")) ## we already handled this one #else $items #end #end
#end ## ## #macro ( makeProject ) #set ($menus = $project.selectNodes("body/menu")) #foreach ( $menu in $menus ) ##foreach ( $tw in $menu.selectNodes("//*") ) ##relativise ($tw) ##end #set ($title = $menu.getChild("title")) #if ($title.getAttributeValue("href")) #else #end #foreach ( $item in $menu.getChildren("li") ) $item #end #end #end ## ## #macro ( listProjects ) #set ($menus = $project.selectNodes("body/projects")) #foreach ( $menu in $menus ) ##foreach ( $tw in $menu.selectNodes("//*") ) ##relativise ($tw) ##end #set ($title = $menu.getChild("title")) #if ($title.getAttributeValue("href")) #else #end #foreach ( $item in $menu.getChildren("li") ) $item #end #foreach ( $item in $menu.getChildren("p") ) $item #end #end #end ## ## #macro ( getProjectImage ) #if ($project.getChild("logo")) The Apache Software Foundation #set ( $logoString = $project.getChild("logo").getAttributeValue("href") ) #if ( $logoString.startsWith("/") ) $project.getChild( #else $project.getChild( #end #else The Apache Software Foundation ## ##

Mirrored
## Worldwide

## #end #end ## ## #macro ( document ) #set ($atoms = $root.getChild("properties").getChildren("atom")) #foreach ( $atom in $atoms ) #metaatom ( $atom.getText() $atom.getAttributeValue("url") ) #end #set ($authors = $root.getChild("properties").getChildren("author")) #foreach ( $au in $authors ) #metaauthor ( $au.getText() $au.getAttributeValue("email") ) #end $root.getChild("properties").getChild("title").getText() - $project.getChild("title").getText() #getProjectImage()

#set ($allSections = $root.getChild("body").getChildren("section")) #foreach ( $section in $allSections ) #section ($section 1) #end

#end