blob: a696c463537db852f4cf3ead19601519b6d743c8 [file] [log] [blame]
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. The ASF licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an
## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
## KIND, either express or implied. See the License for the
## specific language governing permissions and limitations
## under the License.
#document()
<!-- Make a Section header bar -->
#macro ( makeSectionHeader $value )
#if ( $value.getAttributeValue("name") )
#set ( $titleName = $value.getAttributeValue("name") )
#else
#set ( $titleName = "" )
#end
<fo:block font-size="14pt"
font-family="sans-serif"
line-height="24pt"
space-after.optimum="15pt"
background-color="blue"
color="white"
text-align="start"
padding-top="3pt">
$titleName
</fo:block>
#end
<!-- Make a Paragraph -->
#macro ( makeParagraph $value )
<fo:block font-size="12pt"
space-after.optimum="15pt"
font-family="sans-serif"
background-color="white"
color="black"
text-align="start"
padding-top="3pt">
$xmlout.outputString($value)
</fo:block>
#end
<!-- Make a Source Code block -->
#macro ( makeSrc $value )
<fo:block font-size="12pt"
space-after.optimum="15pt"
font-family="sans-serif"
background-color="white"
color="gray"
text-align="start"
padding-top="3pt">
$escape.getText($value.getText())
</fo:block>
#end
<!-- Make an image link -->
#macro ( makeLink $value )
<fo:block font-size="12pt"
space-after.optimum="15pt"
font-family="sans-serif"
background-color="white"
color="gray"
text-align="start"
padding-top="3pt">
<fo:basic-link external-destination="http://test">
TO DO
</fo:basic-link>
</fo:block>
#end
#macro (document)
<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- defines the layout master -->
<fo:layout-master-set>
<fo:simple-page-master
master-name="Velocity"
page-height="8.5in"
page-width="11in"
margin-top="0.25in"
margin-bottom="0.25in"
margin-left="0.5in"
margin-right="0.5in">
<fo:region-before extent="0.25in"/>
<fo:region-body margin-top="0.25in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<!-- starts actual layout -->
<fo:page-sequence master-name="Velocity">
<!-- header -->
<fo:static-content flow-name="xsl-region-before">
<fo:block
text-align="end"
font-size="10pt"
font-family="serif"
color="black"
padding-right="3pt">
$root.getChild("properties").getChild("title").getText() pg <fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
#set ($allSections = $xpath.applyTo("body/section", $root))
<!-- Walk through the sections -->
#foreach ( $section in $allSections )
#makeSectionHeader($section)
#foreach ( $item in $section.getChildren() )
#if ( $item.getName().equals("p") )
#makeParagraph($item)
#elseif ( $item.getName().equals("source") )
#makeSrc($item)
#end
#end
#end
</fo:flow>
</fo:page-sequence>
</fo:root>
#end