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

<!-- infoBlock.v01.xsl contient tous les templates d'affichage d'un infoBlockType de CDM-fr v2 -->

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:ns2="http://cdm-fr.fr/2011/CDM-frSchema"
	exclude-result-prefixes="xsl xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xhtml="http://www.w3.org/1999/xhtml"
	xmlns:fo="http://www.w3.org/1999/XSL/Format">		
	
	<xsl:template match="infoBlock | ns2:infoBlock">
		<fo:block>
			<xsl:apply-templates select="node()"/>
		</fo:block>
	</xsl:template>	
	
	<xsl:template match="subBlock">
		<fo:block>
			<xsl:apply-templates/>
		</fo:block>
	</xsl:template>
	
	<xsl:template match="br">
		<fo:block/>
	</xsl:template>
	
	<xsl:template match="email">
		<xsl:if test="contains(.,'@')">			
			<fo:basic-link external-destination="url('mailto:{node()}')" text-decoration="underline" color="blue">
				<xsl:value-of select="node()"/>
			</fo:basic-link>			
		</xsl:if>
	</xsl:template>
	
	<xsl:template match="searchword">
		<xsl:value-of select="."/>
	</xsl:template>
	
	<xsl:template match="header">
		<fo:block font-size="20">
			<xsl:value-of select="."/>
		</fo:block>
	</xsl:template>
			
	<xsl:template match="text">
		<xsl:value-of select="."/>
	</xsl:template>
	
	<xsl:template match="italic">
		<fo:inline font-style="italic">
			<xsl:apply-templates select="node()"/>
		</fo:inline>
	</xsl:template>
	
	<xsl:template match="bold">
		<fo:inline font-weight="bold">
			<xsl:apply-templates select="node()"/>
		</fo:inline>
	</xsl:template>
	
	<xsl:template match="list">
		<fo:list-block>	
			<xsl:apply-templates select="listItem"/>			
		</fo:list-block>
	</xsl:template>
	<xsl:template match="listItem">
		<fo:list-item>
			<fo:list-item-label><fo:block>&#x2022;</fo:block></fo:list-item-label>
			<fo:list-item-body start-indent="4pt">
				<fo:block>
					<xsl:apply-templates select="node()"/>
				</fo:block>
			</fo:list-item-body>
		</fo:list-item>		
	</xsl:template>
	
	<xsl:template match="webLink">
		<xsl:variable name="http" select="normalize-space(./href)"/>
		<fo:basic-link external-destination="url({$http})" color="blue" text-decoration="underline"><xsl:value-of select="$http"/></fo:basic-link>
	</xsl:template>
		
	<xsl:template match="picture">
		<xsl:variable name="http" select="normalize-space(./webLink/href)"/>
		<fo:external-graphic src="url({$http})"/>
	</xsl:template>	
	
</xsl:stylesheet>