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

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

  <!-- Import DocBook FO stylesheet instead of HTML -->
  <xsl:import href="/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl"/>

  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

  <!-- procedure -->
  <xsl:template match="procedure2">
    <fo:block space-after="10pt" margin-top="10pt">
      <fo:block font-weight="bold" space-after="4pt">
        <xsl:value-of select="@name"/>
      </fo:block>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="procedure">
    <fo:block space-after="10pt">
      <fo:block font-weight="bold" space-after="4pt">
        <xsl:value-of select="@name"/>
      </fo:block>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <!-- arguments -->
  <xsl:template match="arguments">
    <fo:block font-style="italic" space-after="6pt">
      Arguments:
    </fo:block>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="arg">
    <fo:block space-after="6pt">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="argname">
    <fo:block margin-left="30pt" space-before="1pt" space-after="1pt">
      <fo:inline font-weight="bold">Name: </fo:inline>
      <fo:inline font-family="monospace">
        <xsl:apply-templates/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <xsl:template match="argtype">
    <fo:block margin-left="30pt" space-before="1pt" space-after="1pt">
      <fo:inline font-weight="bold">Type: </fo:inline>
      <fo:inline font-family="monospace">
        <xsl:apply-templates/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <xsl:template match="argtype2">
    <fo:block margin-left="30pt" space-before="1pt" space-after="1pt">
      <fo:inline font-weight="bold">Type: </fo:inline>
      <fo:inline>
        <xsl:apply-templates/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <xsl:template match="argdesc">
    <fo:block margin-left="30pt" space-after="6pt">
      <fo:inline font-weight="bold">Description:</fo:inline>
      <fo:block margin-left="20pt" space-after="10pt">
        <xsl:apply-templates/>
      </fo:block>
    </fo:block>
  </xsl:template>

  <xsl:template match="arg-nested">
    <fo:block space-after="6pt">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="argname-nested">
    <fo:block margin-left="30pt" space-before="1pt" space-after="1pt">
      <fo:inline font-weight="bold">Name: </fo:inline>
      <fo:inline font-family="monospace">
        <xsl:apply-templates/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <xsl:template match="argtype-nested">
    <fo:block margin-left="30pt" space-before="1pt" space-after="1pt">
      <fo:inline font-weight="bold">Type: </fo:inline>
      <fo:inline font-family="monospace">
        <xsl:apply-templates/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <xsl:template match="argtype2-nested">
    <fo:block margin-left="30pt" space-before="1pt" space-after="1pt">
      <fo:inline font-weight="bold">Type: </fo:inline>
      <fo:inline>
        <xsl:apply-templates/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <xsl:template match="argdesc-nested">
    <fo:block margin-left="30pt" space-after="6pt">
      <fo:inline font-weight="bold">Description:</fo:inline>
      <fo:block margin-left="20pt" space-after="10pt">
        <xsl:apply-templates/>
      </fo:block>
    </fo:block>
  </xsl:template>

  <xsl:template match="argcomment">
    <fo:block margin-left="30pt" margin-top="6pt" margin-bottom="6pt">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="argheader">
    <fo:block margin-bottom="6pt">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="argheader-nested">
    <fo:block margin-bottom="6pt">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="result-value">
    <fo:block>
      <fo:inline font-style="italic">Result value: </fo:inline>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="result-type">
    <fo:block space-after="6pt">
      <fo:inline font-style="italic">Result type: </fo:inline>
      <fo:inline font-family="monospace">
        <xsl:apply-templates/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <xsl:template match="description">
    <fo:block>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="theme-d-type">
    <fo:block space-after="10pt">
      <fo:block font-weight="bold" space-after="4pt">
        <xsl:value-of select="@name"/>
      </fo:block>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="theme-d-type2">
    <fo:block space-after="10pt" margin-top="10pt">
      <fo:block font-weight="bold" space-after="4pt">
        <xsl:value-of select="@name"/>
      </fo:block>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

  <xsl:template match="metatype">
    <fo:block margin-left="30pt" space-before="1pt" space-after="1pt">
      <fo:inline font-weight="bold">Metatype: </fo:inline>
      <fo:inline>
        <xsl:apply-templates/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <xsl:template match="type-description">
    <fo:block margin-left="30pt" space-after="6pt">
      <fo:inline font-weight="bold">Description:</fo:inline>
      <fo:block margin-left="20pt" space-after="10pt">
        <xsl:apply-templates/>
      </fo:block>
    </fo:block>
  </xsl:template>

</xsl:stylesheet>
