<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- $Id: business-card-demo.xml 633559 2008-03-04 17:35:52Z jeremias $ -->
<section xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <title tab-width="50">An Example</title>
  <p>
    The XML file (a business card):
  </p>
  <fo:block text-align="start" font-family="'Lucida Console'" font-size="10pt" white-space="pre"
  ><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<business-card>
  <name>Pepé Le Pew</name>
  <function>Expert d'Amour</function>
  <address1>13 Pleasantstreet</address1>
  <address2>Acme Acres</address2>
  <phone>+1 (23) 456-7890</phone>
  <mail>pepe@looney.toon</mail>
</business-card>]]></fo:block>
  <fo:block space-before="20pt"/>
  <p>The result:</p>
  <p>
    <fo:instream-foreign-object xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
      <svg:svg width="150mm" height="70mm" viewBox="0 0 150 70">
        <svg:g transform="rotate(-7)">
          <svg:image x="0" y="12" width="84" height="53" xlink:href="../svg/pepe-business-card.svg"/>
        </svg:g>
      </svg:svg>
    </fo:instream-foreign-object>
  </p>
  <fo:block-container absolute-position="absolute" left="80mm" top="20mm" width="3cm" height="10cm">
    <fo:block font-size="0" line-height="0">
      <fo:instream-foreign-object xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
        <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="1.8cm" height="10cm" viewBox="0 0 20 100">
          <defs>
            <marker refX="0" refY="0" orient="auto" style="overflow:visible" id="Arrow1Lend">
              <path
                 d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z "
                 transform="matrix(-0.4,0,0,-0.4,0,0)"
                 style="fill-rule:evenodd;stroke:black;stroke-width:0.5;marker-start:none"
                 id="arrowpath" />
            </marker>
          </defs>
          <g transform="translate(5,0)">
            <path
               d="M 0,0 C 10,10 10,40 0,50"
               style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow1Lend);stroke-opacity:1"
               id="path1872" />
          </g>
        </svg>
      </fo:instream-foreign-object>
    </fo:block>
  </fo:block-container>
  <fo:block-container absolute-position="absolute" width="100%">
    <fo:block start-indent="112mm">
      <p>The XSLT stylesheet which contains the rules to convert the business card XML to XSL-FO:</p>
      <fo:block text-align="start" font-family="'Lucida Console'" font-size="10pt" white-space="pre"
        ><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/">
    <fo:root font-family="Helvetica" font-size="10pt">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="bc"
              page-height="53mm" page-width="84mm" margin="3mm">
          <fo:region-body/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <xsl:apply-templates/>
    </fo:root>
  </xsl:template>
  <xsl:template match="business-card">
    <fo:page-sequence master-reference="bc">
    	<fo:flow flow-name="xsl-region-body">
        <fo:block text-align="end" space-before="9mm" space-before.conditionality="retain">
          <fo:block font-size="14pt" font-weight="bold" space-after="2mm">
            <xsl:value-of select="name"/>
          </fo:block>
          <fo:block font-size="12pt" space-after="6mm">
            <xsl:value-of select="function"/>
          </fo:block>
        </fo:block>
        <fo:block><xsl:value-of select="address1"/></fo:block>
        <fo:block><xsl:value-of select="address2"/></fo:block>
        <fo:block><xsl:value-of select="phone"/></fo:block>
        <fo:block><xsl:value-of select="mail"/></fo:block>
    	</fo:flow>
    </fo:page-sequence>
  </xsl:template>
</xsl:stylesheet>]]></fo:block>
    </fo:block>
  </fo:block-container>

</section>
