<?xml version="1.0" encoding="utf-8"?>
<!-- Created with nothing -->
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="html">

<!-- this looks stupid because it has to -->
<xsl:param name="loglevel" select='info' as="xs:string"/>

<!-- stylesheet for general xhtml2pdf conversion. 
  <xsl:include/> gives precedence to the templates, defined there!
  <xsl:include href="/home/michael/prog/html2Pdf.xsl" />
-->

  <!-- IMPORT gives precedence to the templates, defined here!
  -->
  <xsl:import href="/home/michael/prog/html2Pdf.xsl" />

  <!-- 
    Try to color configuration examples in the same way, when there is only
    one line of text to style. This means splitting up the line after
    EXAMPLE: (evtl. additional  info):
    and handling double-quotes.
    ATTN! The first argument to matches() can contain whitespace. text() will
    result in a sequence and is not possible as argument for the function,
    string() is.
    See also in htl2Pdf.xsl html:pre as literal-block ex Docutils.
  -->
  <xsl:template match="html:blockquote/html:p[matches(string(), '^EXAMPLE:?.*&quot;')]">
  <!-- YEAH... learn Java to remedy this.-->
    <xsl:if test="$loglevel='debug'">
      <xsl:message select="$loglevel">[DEBUG]  handling example </xsl:message>
    </xsl:if>
    <fo:block margin="0.5em 2em 0.5em 2em" wrap-option="wrap">
      <xsl:value-of select="fn:substring-before(string(), '&quot;')"/>

      <fo:inline background-color="#d0d0ff" white-space-collapse="false" 
      linefeed-treatment="preserve" white-space-treatment="preserve" wrap-option="wrap" 
        font-family="AnonymousPro" font-size="0.9em">
        <xsl:value-of select="concat('&quot;', fn:substring-after(string(), '&quot;'))"/>
      </fo:inline>
    </fo:block>
  </xsl:template>

  <!-- configuration options, originally a definition in <dd/> -->
  <xsl:template match="html:blockquote">
    <fo:block margin-left="2em" keep-together.within-page="always" keep-with-previous.within-page="always">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>
</xsl:stylesheet>

<!-- EOF -->