<?xml version="1.0" encoding="UTF-8"?>

<!-- XSLT for creating questions.fo -->
<xsl:stylesheet exclude-result-prefixes="xalan" version="1.0" xmlns:xalan="http://xml.apache.org/xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    
    <!-- format output -->
    <xsl:output encoding="iso-8859-1" indent="yes" method="xml" xalan:indent-amount="4"/>
    
    <!-- match the root --> 
    <xsl:template match="/"> 
        <fo:root>
            <fo:layout-master-set> 
                <fo:simple-page-master master-name="project2"> 
                    <fo:region-body margin="0.25in"/> 
                </fo:simple-page-master> 
            </fo:layout-master-set>
            <fo:page-sequence master-reference="project2"> 
                <fo:flow flow-name="xsl-region-body" font-size="14pt" font-family="Times">
                    <xsl:apply-templates/>
                </fo:flow> 
            </fo:page-sequence>
        </fo:root> 
    </xsl:template>
    
    <!-- create name and project detail -->
    <xsl:template match="name">
        <fo:block text-align="left" space-before="5pt" space-before.conditionality="retain" space-after="10pt"> 
            <xsl:apply-templates select="line"/>
        </fo:block>
    </xsl:template>
    
    <!-- create answer detail -->
    <xsl:template match="answer">
        <fo:block text-align="left" space-before="30pt" space-before.conditionality="retain">
            <xsl:apply-templates select="part"/>
        </fo:block>
    </xsl:template>
    
    <!-- create answer detail -->
    <xsl:template match="part">
        <fo:block text-align="left" space-after="8pt">
            <fo:block><xsl:value-of select="ancestor::answer/@number"/><xsl:value-of select="@name"/>.</fo:block>
            <xsl:apply-templates select="line"/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="line">
        <fo:block><xsl:value-of select="."/></fo:block>
    </xsl:template>
    
</xsl:stylesheet>
