﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output indent="yes" />
  <xsl:strip-space elements="*" />
  <xsl:template match="bookdata">
    <fo:root>
      <fo:layout-master-set>
        <fo:simple-page-master master-name="page-layout" page-height="11in" page-width="8in">
          <fo:region-body margin="1in" region-name="body" background-color="#dddddd" />
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="page-layout">
        <fo:flow flow-name="body">
          <fo:table>
            <fo:table-column column-number="1" column-width="25%" />
            <fo:table-column column-number="2" column-width="60%" />
            <fo:table-column column-number="3" column-width="15%" />
            <fo:table-body>
              <xsl:apply-templates select="book" />
            </fo:table-body>
          </fo:table>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
  <xsl:template match="book">
    <fo:table-row>
      <fo:table-cell border="1pt solid black" padding="4pt">
        <fo:block>
          <xsl:value-of select="isbn/text()" />
        </fo:block>
      </fo:table-cell>
      <fo:table-cell border="1pt solid black" padding="4pt">
        <fo:block>
          <xsl:value-of select="title/text()" />
        </fo:block>
      </fo:table-cell>
      <fo:table-cell border="1pt solid black" padding="4pt" text-align="right">
        <fo:block>
          <xsl:value-of select="price/text()" />
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
  </xsl:template>
</xsl:stylesheet>