xml version="1.0" encoding="utf-8"
<xslstylesheet version="2.0"
xmlnsxsl="http://www.w3.org/1999/XSL/Transform"
xmlnsfo="http://www.w3.org/1999/XSL/Format"
xmlnshtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="html">
<xsloutput method="xml" indent="yes" />
<xslvariable name="lowercase"
select="'abcdefghijklmnopqrstuvwxyz'" />
<xslvariable name="uppercase"
select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xslvariable name="title">
<xslvalue-of select="//title" />
</xslvariable>
<xsltemplate match="/">
<foroot font-family="Classica, Helvetica, ZapfDingbats, Symbol">
<folayout-master-set>
<fosimple-page-master master-name="A4-portrait"
page-height="29.7cm" page-width="21.0cm" margin="2cm">
<foregion-body margin-bottom="1cm" />
<foregion-after extent="1cm" />
</fosimple-page-master>
</folayout-master-set>
<fobookmark-tree>
<xslcall-template name="bookmark" />
</fobookmark-tree>
<fopage-sequence master-reference="A4-portrait">
<fotitle>
<xslvalue-of select="$title" />
</fotitle>
<fostatic-content flow-name="xsl-region-after">
<foblock>
<fotable space-before="1em" margin-left="0"
padding="0" width="100%"
border-top="0.5pt solid darkgreen">
<fotable-column />
<fotable-column />
<fotable-body>
<fotable-row>
<fotable-cell>
<foblock margin-left="2em">
<xslcall-template name="footer-left" />
</foblock>
</fotable-cell>
<fotable-cell>
<foblock>
<xslcall-template name="footer-right" />
</foblock>
</fotable-cell>
</fotable-row>
</fotable-body>
</fotable>
</foblock>
</fostatic-content>
<foflow flow-name='xsl-region-body'>
<foblock>
<xslapply-templates select="/html:html/html:body" />
</foblock>
</foflow>
</fopage-sequence>
</foroot>
</xsltemplate>
<xsltemplate match="html:body">
<xslapply-templates select="//html:main" />
</xsltemplate>
<xsltemplate name="footer-left">
<fobasic-link color="#005000" text-decoration="underline">
<xslchoose>
<xslwhen test="//h1[@class='title'] = 'flnews'">
<xslattribute name="external-destination">
url(https://micha.freeshell.org/flnews/)</xslattribute>
</xslwhen>
<xslotherwise>
<xslattribute name="external-destination">
url(https://www.uplawski.eu/software)</xslattribute>
</xslotherwise>
</xslchoose>Web-Site</fobasic-link>
</xsltemplate>
<xsltemplate name="footer-right">
</xsltemplate>
<xsltemplate match="b[@id='omega']">
<foinline padding-left="5em" font-weight="bold"
page-break-before="avoid" keep-with-previous="always"
color="#800080">Ω</foinline>
</xsltemplate>
<xsltemplate name="bookmark">
<xslmessage>[DEBUG]in the bookmark template</xslmessage>
<xslfor-each select="//html:h1">
<xslvariable name="h1_id" select="../@id" />
<xslmessage>bookmarking h1 id <xslvalue-of select="$h1_id"/></xslmessage>
<fobookmark internal-destination="bk_{$h1_id}">
<fobookmark-title>
<xslvalue-of select="." />
</fobookmark-title>
<xslfor-each select="following-sibling::html:section[@id]/html:h2">
<xslvariable name="h2_id" select="../@id" />
<fobookmark internal-destination="bk_{$h2_id}">
<xslmessage>bookmarking h2 id <xslvalue-of select="$h2_id"/></xslmessage>
<fobookmark-title>
<xslvalue-of select="." />
</fobookmark-title>
<xslfor-each select="following-sibling::html:section[@id]/html:h3">
<xslvariable name="h3_id" select="../@id" />
<xslmessage><xsltext> </xsltext>bookmarking h3 id <xslvalue-of select="$h3_id"/></xslmessage>
<fobookmark internal-destination="bk_{$h3_id}">
<fobookmark-title>
<xslvalue-of select="." />
</fobookmark-title>
<xslfor-each select="following-sibling::html:section[@id]/html:h4">
<xslmessage><xsltext> </xsltext>bookmarking h4</xslmessage>
<xslvariable name="h4_id" select="../@id" />
<fobookmark internal-destination="bk_{$h4_id}">
<fobookmark-title>
<xslvalue-of select="." />
</fobookmark-title>
<xslfor-each select="following-sibling::html:section[@id]/html:h5">
<xslmessage><xsltext> </xsltext>bookmarking h5</xslmessage>
<xslvariable name="h5_id" select="../@id" />
<fobookmark internal-destination="bk_{$h5_id}">
<fobookmark-title>
<xslvalue-of select="." />
</fobookmark-title>
</fobookmark>
</xslfor-each>
</fobookmark>
</xslfor-each>
</fobookmark>
</xslfor-each>
</fobookmark>
</xslfor-each>
</fobookmark>
</xslfor-each>
</xsltemplate>
<xsltemplate match="html:main">
<xslapply-templates />
</xsltemplate>
<xsltemplate match="html:h1">
<xslvariable name="h1_id">
<xslvalue-of select="../@id" />
</xslvariable>
<xslchoose>
<xslwhen test="@class='title'">
<foblock id="bk_{$h1_id}" keep-with-next="always"
color="#800080" font-size="19pt" margin-bottom='1em'
font-weight="bold">
<xslvalue-of select="." />
</foblock>
</xslwhen>
<xslotherwise>
<foblock id="{$h1_id}" color="blue" font-size="13pt"
margin-top="1em" font-weight="bold"
keep-with-next="always">
<xslvalue-of select="." />
</foblock>
</xslotherwise>
</xslchoose>
</xsltemplate>
<xsltemplate match="html:p[@class='subtitle']">
<foblock id="{@id}" color="#600080" font-size="13pt"
margin-bottom='1em' keep-with-next="always">
<xslvalue-of select="." />
</foblock>
</xsltemplate>
<xsltemplate match="html:nav">
</xsltemplate>
<xsltemplate match="html:h2">
<xslvariable name="id">
<xslvalue-of select="../@id" />
</xslvariable>
<foblock id="bk_{$id}" font-weight="bold" color="#a00060"
font-size="13pt" margin-bottom='1em' margin-top="1em"
keep-with-next="always">
<xslvalue-of select="." />
</foblock>
</xsltemplate>
<xsltemplate match="html:h3">
<xslvariable name="id">
<xslvalue-of select="../@id" />
</xslvariable>
<foblock id="bk_{$id}" color="#a00040" font-size="13pt"
margin-bottom='1em' margin-top="1em" margin-left="1.5em"
keep-with-nextwithin-page="always">
<xslvalue-of select="." />
</foblock>
</xsltemplate>
<xsltemplate match="html:h4">
<xslvariable name="id">
<xslvalue-of select="../@id" />
</xslvariable>
<foblock id="bk_{$id}" color="#700040" font-weight="bold"
font-size="12pt" margin-bottom='1em' margin-top="1em"
margin-left="2em" keep-with-next="always">
<xslvalue-of select="." />
</foblock>
</xsltemplate>
<xsltemplate match="html:dl">
<foblock>
<xslapply-templates />
</foblock>
</xsltemplate>
<xsltemplate match="html:dt">
<foblock id="{@id}" keep-with-nextwithin-page="always"
font-weight="bold" margin-left="2em" margin-top="0.5em">
<xslvalue-of select="." />
</foblock>
</xsltemplate>
<xsltemplate match="html:dd">
<foblock margin-left="4em" keep-togetherwithin-page="always">
<xslapply-templates />
</foblock>
</xsltemplate>
<xsltemplate match="html:p[ancestor::html:dd[1]]">
<xslapply-templates />
</xsltemplate>
<xsltemplate match="html:p[ancestor::html:table[1]]">
<foblock id="{@id}">
<xslapply-templates />
</foblock>
</xsltemplate>
<xsltemplate match="html:p">
<foblock id="{@id}" margin-left="2em" margin-top="0.5em">
<xslif test="@id">
<xslattribute name="keep-with-next">always</xslattribute>
</xslif>
<xslapply-templates />
</foblock>
</xsltemplate>
<xsltemplate match="html:table">
<fotable keep-togetherwithin-page="auto" margin-top="0.5em"
font-size="0.9em" padding="0.5em" border-collapse="separate"
table-layout="fixed" width="90%" margin-left="2em"
border="1pt dotted crimson">
<xslapply-templates />
</fotable>
</xsltemplate>
<xsltemplate match="html:tbody">
<fotable-body>
<xslapply-templates />
</fotable-body>
</xsltemplate>
<xsltemplate match="html:thead">
<fotable-header>
<xslapply-templates />
</fotable-header>
</xsltemplate>
<xsltemplate match="html:th">
<xslchoose>
<xslwhen test="normalize-space(.) != ''">
<fotable-cell font-weight="bold" empty-cells="show">
<xslapply-templates />
</fotable-cell>
</xslwhen>
<xslotherwise>
<fotable-cell empty-cells="show">
<foblock white-space-treatment="preserve">
<foleader />
</foblock>
</fotable-cell>
</xslotherwise>
</xslchoose>
</xsltemplate>
<xsltemplate match="html:tr[position() < 5]">
<fotable-row keep-with-next="always">
<xslapply-templates />
</fotable-row>
</xsltemplate>
<xsltemplate match="html:tr[position() > (last() - 5)]">
<fotable-row keep-with-previous="always">
<xslapply-templates />
</fotable-row>
</xsltemplate>
<xsltemplate match="html:tr">
<fotable-row>
<xslapply-templates />
</fotable-row>
</xsltemplate>
<xsltemplate match="html:td">
<xslchoose>
<xslwhen test="normalize-space(.) != ''">
<fotable-cell padding-before="0" padding-start="0"
empty-cells="show">
<xslapply-templates />
</fotable-cell>
</xslwhen>
<xslotherwise>
<fotable-cell empty-cells="show">
<foblock white-space-treatment="preserve">
<foleader />
</foblock>
</fotable-cell>
</xslotherwise>
</xslchoose>
</xsltemplate>
<xsltemplate match="html:ul">
<folist-block provisional-distance-between-starts="10mm"
end-indent="10mm" start-indent="10mm">
<xslapply-templates />
</folist-block>
</xsltemplate>
<xsltemplate match="html:ul/html:li">
<folist-item keep-togetherwithin-page='always'>
<folist-item-label end-indent='label-end()'>
<foblock margin-top='0.5em' font-family='DejaVu Sans'>▸</foblock>
</folist-item-label>
<folist-item-body start-indent='body-start()'>
<foblock margin-top='0.5em'>
<xslapply-templates />
</foblock>
</folist-item-body>
</folist-item>
</xsltemplate>
<xsltemplate match="html:ol">
<folist-block provisional-distance-between-starts="10mm"
end-indent="10mm" start-indent="10mm">
<xslapply-templates />
</folist-block>
</xsltemplate>
<xsltemplate match="html:ol/html:li">
<folist-item keep-togetherwithin-page='always'>
<folist-item-label end-indent='label-end()'>
<foblock margin-top='0.5em'>
<xslnumber format='1.' />
</foblock>
</folist-item-label>
<folist-item-body start-indent='body-start()'>
<foblock margin-top='0.5em'>
<xslapply-templates />
</foblock>
</folist-item-body>
</folist-item>
</xsltemplate>
<xsltemplate match="html:pre[@class='literal-block']">
<foblock
background-color="#d0d0ff"
margin="0.5em 2em 0.5em 2em"
padding="0.5em"
white-space-collapse="false"
linefeed-treatment="preserve"
white-space-treatment="preserve"
wrap-option="wrap"
font-family="AnonymousPro"
font-size="0.9em">
<xslapply-templates/>
</foblock>
</xsltemplate>
<xsltemplate match="html:span">
<foinline id="{@id}">
<xslvalue-of select="." />
</foinline>
</xsltemplate>
<xsltemplate match="html:span[@class='docutils literal']">
<foinline id="{@id}" font-family='AnonymousPro' color="darkblue">
<xslvalue-of select="." />
</foinline>
</xsltemplate>
<xsltemplate match="html:span[@class='pre']">
<foinline id="{@id}" font-family='AnoymousPro' color="darkblue">
<xslvalue-of select="." />
</foinline>
</xsltemplate>
<xsltemplate match="html:em">
<foinline font-style="italic">
<xslvalue-of select="." />
</foinline>
</xsltemplate>
<xsltemplate match="html:strong">
<foinline font-weight="bold">
<xslvalue-of select="." />
</foinline>
</xsltemplate>
<xsltemplate match="html:a">
<xslchoose>
<xslwhen test="starts-with(@href, '#')">
<xslvariable name="dest">
<xslvalue-of select="substring-after(./@href, '#')" />
</xslvariable>
<fobasic-link internal-destination="{$dest}"
color="#300030" text-decoration="underline">
<xslvalue-of select="." />
<xslmessage> internal destination <xslvalue-of select="." />,
<xslvalue-of select="substring-after(./@href, '#')" /></xslmessage>
</fobasic-link>
</xslwhen>
<xslotherwise>
<xslvariable name="dest">
<xslvalue-of select="./@href" />
</xslvariable>
<fobasic-link external-destination="{$dest}"
color="#300030" text-decoration="underline">
<xslvalue-of select="." />
</fobasic-link>
</xslotherwise>
</xslchoose>
</xsltemplate>
</xslstylesheet>