Commit 84edcb18 authored by bperraud's avatar bperraud

Flatten of last div + handling of microformats

parent dc2f0d6a
...@@ -65,7 +65,8 @@ ...@@ -65,7 +65,8 @@
<xslt in="{$TempDirectory}/{$path}" out="{$dirpath}/hdoc_nsless.xhtml" style="xsl/ns_remover.xsl" classpath="./lib/saxon9he.jar"/> <xslt in="{$TempDirectory}/{$path}" out="{$dirpath}/hdoc_nsless.xhtml" style="xsl/ns_remover.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$dirpath}/hdoc_nsless.xhtml" out="{$dirpath}/flat_hdoc.xhtml" style="xsl/hdoc_flattenizer.xsl" classpath="./lib/saxon9he.jar"/> <xslt in="{$dirpath}/hdoc_nsless.xhtml" out="{$dirpath}/flat_hdoc.xhtml" style="xsl/hdoc_flattenizer.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$dirpath}/flat_hdoc.xhtml" out="{$dirpath}/pre_final.xhtml" style="xsl/toc_generator.xsl" classpath="./lib/saxon9he.jar"/> <xslt in="{$dirpath}/flat_hdoc.xhtml" out="{$dirpath}/post_toc.xhtml" style="xsl/toc_generator.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$dirpath}/post_toc.xhtml" out="{$dirpath}/pre_final.xhtml" style="xsl/microformat_transformer.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$dirpath}/pre_final.xhtml" out="{$dirpath}/final.xhtml" style="xsl/last_transformer.xsl" classpath="./lib/saxon9he.jar"/> <xslt in="{$dirpath}/pre_final.xhtml" out="{$dirpath}/final.xhtml" style="xsl/last_transformer.xsl" classpath="./lib/saxon9he.jar"/>
<propertyfile file="{$TempDirectory}/my.properties"> <propertyfile file="{$TempDirectory}/my.properties">
......
...@@ -28,6 +28,16 @@ ...@@ -28,6 +28,16 @@
<xsl:apply-templates select="node()"/> <xsl:apply-templates select="node()"/>
</xsl:template> </xsl:template>
<!-- Suppression des div de micro-formats -->
<xsl:template match="div[@data-hdoc-type=('definition', 'example', 'remark', 'advice', 'warning', 'complement', 'emphasis')]">
<xsl:apply-templates select="node()"/>
</xsl:template>
<!-- Suppression des div génériques -->
<xsl:template match="div">
<xsl:apply-templates select="node()"/>
</xsl:template>
<!-- Traitement des liens hypertextes pour autoriser le saut à la ligne--> <!-- Traitement des liens hypertextes pour autoriser le saut à la ligne-->
<xsl:template match="a"> <xsl:template match="a">
<a> <a>
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xpath-default-namespace="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Traitement des micro-formats -->
<xsl:template match="node()[local-name()=('h2', 'h3', 'h4', 'h5', 'h6') and parent::div[@data-hdoc-type=('definition', 'example', 'remark', 'advice', 'warning', 'complement', 'emphasis')]]">
<xsl:variable name="prename" select="concat(lower-case(substring(./text(), 1, 1)), substring(./text(), 2))"/>
<xsl:variable name="type" select="parent::div/@data-hdoc-type"/>
<xsl:variable name="prefix">
<xsl:choose>
<xsl:when test="$type = 'definition'">
<xsl:text>Définition</xsl:text>
</xsl:when>
<xsl:when test="$type = 'example'">
<xsl:text>Exemple</xsl:text>
</xsl:when>
<xsl:when test="$type = 'remark'">
<xsl:text>Remarque</xsl:text>
</xsl:when>
<xsl:when test="$type = 'advice'">
<xsl:text>Conseil</xsl:text>
</xsl:when>
<xsl:when test="$type = 'warning'">
<xsl:text>Attention</xsl:text>
</xsl:when>
<xsl:when test="$type = 'complement'">
<xsl:text>Complément</xsl:text>
</xsl:when>
<xsl:when test="$type = 'emphasis'">
<xsl:text>Fondamental</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:value-of select="concat($prefix, ' : ', $prename)"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment