<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
  Adresses.xsl V_0.1
  Feuille de style pour mettre en forme une exportation au format csv
  depuis Jpilot

  (c) 2003 Antoine CANONNE <antoine.canonne@free.fr>

-->

<xsl:template match="//adressbook">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <fo:layout-master-set>
    <fo:simple-page-master master-name="couverture">
      <fo:region-body margin="1in"/>
	  <fo:region-after extent="1.5cm"/>
    </fo:simple-page-master>

    <fo:simple-page-master master-name="my-page">
      <fo:region-body margin="1in"/>
	  <!-- <fo:region-after extent="1.5in" padding="6pt 1in" border-bottom="0.5pt  solid" display-align="after" /> -->
	  <fo:region-after extent="1.5cm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>

  <fo:page-sequence master-reference="couverture">
    <fo:flow flow-name="xsl-region-body">
	<fo:block space-before="10cm" font-family="Times" font-size="24pt" text-align="center">
	Carnet d'adresses
	</fo:block>
	</fo:flow>
  </fo:page-sequence>

  <fo:page-sequence master-reference="my-page">

	  <fo:static-content flow-name="xsl-region-after" font-size="10pt" font-style="italic" font-family="Times">
	    <fo:block>(c)2003 Antoine CANONNE     page <fo:page-number/> sur <fo:page-number-citation ref-id="derniere-page"/></fo:block>
	  </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
	  <!-- definition d'une personne -->
	  <xsl:for-each select="./person">

	  <!-- entete fiche -->
	  <fo:block font-family="Times" font-size="14pt" font-weight="bold">
	  <xsl:value-of select="./Last"/> &#160;<xsl:value-of select="./First"/>
	  <xsl:if test="Category != ''">
	    <fo:inline font-size="12pt" font-weight="normal"> &#40; <xsl:value-of select="./Category"/> &#41;</fo:inline>
	  </xsl:if>
	  </fo:block>

	  <!-- nom de famille -->
	  <xsl:if test="Last != ''">
      <fo:block>Nom : <xsl:value-of select="./Last"/></fo:block>
	  </xsl:if>
	  
	  <!-- prenom -->
	  <xsl:if test="First != ''">
      <fo:block>Prénom : <xsl:value-of select="./First"/></fo:block>
	  </xsl:if>

	  <!-- société -->
	  <xsl:if test="Company != ''">
      <fo:block>Société : <xsl:value-of select="./Company"/></fo:block>
	  </xsl:if>


	  <!-- adresse -->
	  <xsl:if test="Address != '' ">
	  <fo:block>Adresse: 
        <xsl:value-of select="./Address"/>&#160; 
        <xsl:value-of select="./ZipCode"/> &#160;
        <xsl:value-of select="./City"/>&#160;
	  </fo:block>
	  </xsl:if>

	  <!-- tel email fax etc... -->
	  <xsl:if test="Phone1 != ''">
	    <fo:block>
	      <xsl:if test="phoneLabel1 = 0">Bureau :</xsl:if>
	      <xsl:if test="phoneLabel1 = 1">Domicile :</xsl:if>
	      <xsl:if test="phoneLabel1 = 2">Fax :</xsl:if>
          <xsl:if test="phoneLabel1 = 3">Autre:</xsl:if>
	      <xsl:if test="phoneLabel1 = 4"></xsl:if>
	      <xsl:if test="phoneLabel1 = 5">Principal :</xsl:if>
	      <xsl:if test="phoneLabel1 = 6">Bipeur :</xsl:if>
	      <xsl:if test="phoneLabel1 = 7">Portable :</xsl:if>
		  <xsl:if test="phoneLabel1 != 4"><xsl:value-of select="./Phone1"/></xsl:if>
		  <xsl:if test="phoneLabel1 = 4">
             Email : <fo:basic-link external-destination="url('mailto://{./Phone1}/')" text-decoration="underline" color="blue">
	           <xsl:value-of select="./Phone1"/>
		     </fo:basic-link>
		  </xsl:if>
		  </fo:block>
	  </xsl:if>
	  <xsl:if test="Phone2 != ''">
	    <fo:block>
	      <xsl:if test="phoneLabel2 = 0">Bureau :</xsl:if>
	      <xsl:if test="phoneLabel2 = 1">Domicile :</xsl:if>
	      <xsl:if test="phoneLabel2 = 2">Fax :</xsl:if>
          <xsl:if test="phoneLabel2 = 3">Autre:</xsl:if>
	      <xsl:if test="phoneLabel2 = 4"></xsl:if>
	      <xsl:if test="phoneLabel2 = 5">Principal :</xsl:if>
	      <xsl:if test="phoneLabel2 = 6">Bipeur :</xsl:if>
	      <xsl:if test="phoneLabel2 = 7">Portable :</xsl:if>
		  <xsl:if test="phoneLabel2 != 4"><xsl:value-of select="./Phone2"/></xsl:if>
		  <xsl:if test="phoneLabel2 = 4">
             Email : <fo:basic-link external-destination="url('mailto://{./Phone2}/')" text-decoration="underline" color="blue">
	           <xsl:value-of select="./Phone2"/>
		     </fo:basic-link>
		  </xsl:if>
	
		  </fo:block>
	  </xsl:if>
	  <xsl:if test="Phone3 != ''">
	    <fo:block>
	      <xsl:if test="phoneLabel3 = 0">Bureau :</xsl:if>
	      <xsl:if test="phoneLabel3 = 1">Domicile :</xsl:if>
	      <xsl:if test="phoneLabel3 = 2">Fax :</xsl:if>
          <xsl:if test="phoneLabel3 = 3">Autre:</xsl:if>
	      <xsl:if test="phoneLabel3 = 4"></xsl:if>
	      <xsl:if test="phoneLabel3 = 5">Principal :</xsl:if>
	      <xsl:if test="phoneLabel3 = 6">Bipeur :</xsl:if>
	      <xsl:if test="phoneLabel3 = 7">Portable :</xsl:if>
		  <xsl:if test="phoneLabel3 != 4"><xsl:value-of select="./Phone3"/></xsl:if>
		  <xsl:if test="phoneLabel3 = 4">
             Email : <fo:basic-link external-destination="url('mailto://{./Phone3}/')" text-decoration="underline" color="blue">
	           <xsl:value-of select="./Phone3"/>
		     </fo:basic-link>
		  </xsl:if>
		  </fo:block>
	  </xsl:if>
	  <xsl:if test="Phone4 != ''">
	    <fo:block>
	      <xsl:if test="phoneLabel4 = 0">Bureau :</xsl:if>
	      <xsl:if test="phoneLabel4 = 1">Domicile :</xsl:if>
	      <xsl:if test="phoneLabel4 = 2">Fax :</xsl:if>
          <xsl:if test="phoneLabel4 = 3">Autre:</xsl:if>
	      <xsl:if test="phoneLabel4 = 4"></xsl:if>
	      <xsl:if test="phoneLabel4 = 5">Principal :</xsl:if>
	      <xsl:if test="phoneLabel4 = 6">Bipeur :</xsl:if>
	      <xsl:if test="phoneLabel4 = 7">Portable :</xsl:if>
		  <xsl:if test="phoneLabel4 != 4"><xsl:value-of select="./Phone4"/></xsl:if>
		  <xsl:if test="phoneLabel4 = 4">
             Email : <fo:basic-link external-destination="url('mailto://{./Phone4}/')" text-decoration="underline" color="blue">
	           <xsl:value-of select="./Phone4"/>
		     </fo:basic-link>
		  </xsl:if>
		  </fo:block>
	  </xsl:if>
	  <xsl:if test="Phone5 != ''">
	    <fo:block>
	      <xsl:if test="phoneLabel5 = 0">Bureau :</xsl:if>
	      <xsl:if test="phoneLabel5 = 1">Domicile :</xsl:if>
	      <xsl:if test="phoneLabel5 = 2">Fax :</xsl:if>
          <xsl:if test="phoneLabel5 = 3">Autre:</xsl:if>
	      <xsl:if test="phoneLabel5 = 4"></xsl:if>
	      <xsl:if test="phoneLabel5 = 5">Principal :</xsl:if>
	      <xsl:if test="phoneLabel5 = 6">Bipeur :</xsl:if>
	      <xsl:if test="phoneLabel5 = 7">Portable :</xsl:if>
		  <xsl:if test="phoneLabel5 != 4"><xsl:value-of select="./Phone5"/></xsl:if>
		  <xsl:if test="phoneLabel5 = 4">
             Email : <fo:basic-link external-destination="url('mailto://{./Phone5}/')" text-decoration="underline" color="blue">
	           <xsl:value-of select="./Phone5"/>
		     </fo:basic-link>
		  </xsl:if>
	    </fo:block>
	  </xsl:if>

	  <!-- Note -->
		<xsl:if test="Note != ''"> 
		<fo:block>
		    Note : <xsl:value-of select="./Note"/>
		</fo:block>
	  </xsl:if>
	
	  <fo:block>
	  <!-- SEPARATION ENTRE LES ENREGISTREMENTS -->
	  <fo:leader leader-length="2in" leader-pattern="rule"  rule-thickness="0.5pt" color="black"/> 
	  <!-- <fo:inline font-size="16pt" font-family=" ZapfDingbats" color="#E00000">&#x274B;</fo:inline> -->
	  <fo:leader leader-length="2in" leader-pattern="rule"  rule-thickness="0.5pt" color="black"/>
	  </fo:block>
	  <!-- /SEPARATION ENTRE LES ENREGISTREMENTS -->
	  </xsl:for-each>
	  <fo:block id="derniere-page"/> <!-- pour avoir le nb tot de pages ds le doc -->
	</fo:flow>
  </fo:page-sequence>
</fo:root>

</xsl:template>
</xsl:stylesheet>

