print_answer.xslt

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
		xmlns:fo="http://www.w3.org/1999/XSL/Format" 
		version="1.0"
>

  <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <!-- defines page layout -->
      <fo:layout-master-set>
	<fo:simple-page-master master-name="normal"
			       height="29.7cm" 
			       width="21cm"
			       margin-top="1.0cm" 
			       margin-bottom="1.0cm" 
			       margin-left="2.5cm" 
			       margin-right="2.5cm">
	  <fo:region-before extent="1.5cm"/>
	  <fo:region-body margin-top="3cm"/>
	  <fo:region-after extent="1.5cm"/>
	</fo:simple-page-master>
      </fo:layout-master-set>
    <xsl:apply-templates select="cexml"/>      
    </fo:root>      
  </xsl:template>

  <xsl:template match="cexml">
    <fo:page-sequence master-name="normal">
      <fo:flow>
	<fo:block font-size="50pt" 
		  font-family="sans-serif" 
		  line-height="50pt"
		  space-after.optimum="50pt"
		  background-color="gray"
		  color="white"
		  text-align="center">
	  Articles found
	</fo:block>
	<xsl:apply-templates select="builtobject" />
      </fo:flow>
    </fo:page-sequence>
  </xsl:template>

  <xsl:template match="builtobject">
    <!-- print the name of the builtobject pretty big -->
    <fo:block font-size="30pt" 
	      font-family="sans-serif" 
	      line-height="30pt"
	      space-after.optimum="15pt"
	      color="gray"
	      text-align="left">
      <xsl:value-of select='name[@language="en"]' />
    </fo:block>
    <!-- print the supplier's name -->
    <fo:block font-size="18pt" 
	      font-family="sans-serif" 
	      line-height="18pt"
	      space-after.optimum="15pt"
	      color="black"
	      margin-left="1cm"
	      text-align="left">
      Supplier: <xsl:value-of select='@supplier' />
    </fo:block>
    <xsl:apply-templates select="characteristics/quantification" />
  </xsl:template>

  <xsl:template match="quantification">
    <!-- print the quantification -->
    <fo:block font-size="18pt" 
	      font-family="sans-serif" 
	      line-height="18pt"
	      space-after.optimum="15pt"
	      color="black"
	      margin-left="1cm"
	      text-align="left">
      <xsl:value-of select='name[@language="en"]' />=
      <xsl:value-of select='amount' />
      <xsl:value-of select='unit/name[@language="en"]' />
    </fo:block>
  </xsl:template>
  
</xsl:stylesheet>