Skip to content

Commit

Permalink
Merge pull request #156 from BulotF/master
Browse files Browse the repository at this point in the history
pdf : odd and even in lanscape
  • Loading branch information
bwerquin authored Oct 29, 2018
2 parents 601fd47 + 095da4a commit adb06bc
Show file tree
Hide file tree
Showing 10 changed files with 393 additions and 475 deletions.
60 changes: 60 additions & 0 deletions questionnaires/esa-2018-a00/barcode-specific-treatment.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:barcode="http://barcode4j.krysalis.org/ns"
exclude-result-prefixes="xs"
version="2.0">

<xsl:output method="xml" indent="yes" encoding="UTF-8"/>

<xd:doc>
<xd:desc>
<xd:p>Template de racine, on applique les templates de tous les enfants</xd:p>
</xd:desc>
</xd:doc>
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
<xd:doc>
<xd:desc>
<xd:p>Template de base pour tous les éléments et tous les attributs, on recopie
simplement en sortie</xd:p>
</xd:desc>
</xd:doc>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>

<xsl:template match="barcode:barcode/@message">
<xsl:variable name="descendant-id" select="ancestor::pageViewport/descendant::block[@prod-id][1]/@prod-id"/>
<xsl:variable name="page-id">
<xsl:choose>
<xsl:when test="$descendant-id !=''">
<xsl:analyze-string select="$descendant-id" regex="^(.+)-1$">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:analyze-string select="$descendant-id" regex="^(.+)-([0-9])+$">
<xsl:matching-substring>
<xsl:value-of select="concat(regex-group(1),'-0')"/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="$descendant-id"/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'no-id-page'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<xsl:attribute name="message" select="replace(.,'#page-id#',$page-id)"/>
</xsl:template>

</xsl:stylesheet>
4 changes: 3 additions & 1 deletion questionnaires/esa-2018-a00/parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
<DefaultSize>3</DefaultSize>
</Row>
</TextArea>

<Capture>
<Numeric>manual</Numeric>
</Capture>
<AccompanyingMails>
<AccompanyingMail>ouvertureCOL</AccompanyingMail>
</AccompanyingMails>
Expand Down
56 changes: 30 additions & 26 deletions questionnaires/esa-2018-a00/pdf-specific-treatment.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:barcode="http://barcode4j.krysalis.org/ns"
exclude-result-prefixes="xs"
version="2.0">

Expand Down Expand Up @@ -61,13 +62,13 @@
<xsl:apply-templates select="node() | @*" mode="#current"/>
</xsl:copy>
</xsl:template>

<!--
<xsl:template match="fo:external-graphic/@src[contains(.,'mask_number.png')]" mode="#all">
<xsl:attribute name="src">
<xsl:value-of select="replace(.,'mask_number.png','mask_number_esa.png')"/>
</xsl:attribute>
</xsl:template>

-->
<xsl:template match="fo:block[contains(@id,'-')]">
<xsl:variable name="roster-name" select="substring-before(@id,'-')"/>
<xsl:variable name="page-number" select="substring-after(@id,'-')"/>
Expand Down Expand Up @@ -205,61 +206,64 @@
<xsl:param name="roster-name" tunnel="yes"/>
<xsl:param name="line-number" as="xs:integer" tunnel="yes"/>

<xsl:value-of select="concat('#{if}($!{',$roster-name,'-',$line-number,'-',$roster-name,'_LIB})')"/>
<xsl:value-of select="concat('#{if}($!{',$roster-name,'-',$line-number,'-',$roster-name,'_CO})')"/>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<fo:block>
<xsl:element name="fo:block">
<xsl:value-of select="concat('$!{',$roster-name,'-',$line-number,'-',$roster-name,'_CO}')"/>
</fo:block>
</xsl:element>
</xsl:copy>
<xsl:value-of select="'#{else}'"/>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="background-color" select="'#CCCCCC'"/>
<fo:block/>
<xsl:element name="fo:block"/>
</xsl:copy>
<xsl:value-of select="'#{end}'"/>
<!--
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:value-of select="concat('#{if}($!{',$roster-name,'-',$line-number,'-',$roster-name,'_LIB})')"/>
<xsl:value-of select="concat('&lt;fo:block&gt;$!{',$roster-name,'-',$line-number,'-',$roster-name,'_CO}&lt;/fo:block&gt;')"/>
<xsl:value-of select="'#{else}&lt;fo:block width=&quot;100%&quot; height=&quot;100%&quot; background-color=&quot;#CCCCCC&quot;/&gt;'"/>
<xsl:value-of select="'#{end}'"/>
</xsl:copy>-->
</xsl:template>

<xsl:template match="fo:table-body/fo:table-row/fo:table-cell[3]" mode="roster">
<xsl:param name="roster-name" tunnel="yes"/>
<xsl:param name="line-number" as="xs:integer" tunnel="yes"/>

<xsl:value-of select="concat('#{if}(!$!{',$roster-name,'-',$line-number,'-',$roster-name,'_LIB} or $!{',$roster-name,'-',$line-number,'-',$roster-name,'_MO})')"/>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:value-of select="concat('#{if}($!{',$roster-name,'-',$line-number,'-',$roster-name,'_LIB} and !$!{',$roster-name,'-',$line-number,'-',$roster-name,'_MO})')"/>
<fo:block/>
<xsl:value-of select="'#{else}'"/>
<xsl:apply-templates select="node()" mode="roster"/>
<xsl:value-of select="'#{end}'"/>
</xsl:copy>
<xsl:value-of select="'#{else}'"/>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="background-color" select="'#CCCCCC'"/>
<xsl:element name="fo:block"/>
</xsl:copy>
<xsl:value-of select="'#{end}'"/>
</xsl:template>

<xsl:template match="fo:table-body/fo:table-row/fo:table-cell[4]" mode="roster">
<xsl:param name="roster-name" tunnel="yes"/>
<xsl:param name="line-number" as="xs:integer" tunnel="yes"/>

<xsl:value-of select="concat('#{if}(!$!{',$roster-name,'-',$line-number,'-',$roster-name,'_LIB} or $!{',$roster-name,'-',$line-number,'-',$roster-name,'_MOST})')"/>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:value-of select="concat('#{if}($!{',$roster-name,'-',$line-number,'-',$roster-name,'_LIB} and !$!{',$roster-name,'-',$line-number,'-',$roster-name,'_MOST})')"/>
<xsl:value-of select="'&lt;fo:block/&gt;#{else}'"/>
<xsl:apply-templates select="node()" mode="roster"/>
<xsl:value-of select="'#{end}'"/>
</xsl:copy>
</xsl:template>

<xsl:template match="fo:block[fo:external-graphic and contains(text(),'(JJMMAAAA)')]">
<xsl:value-of select="'#{else}'"/>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<fo:external-graphic src="date.png"/>
</xsl:copy>
<xsl:attribute name="background-color" select="'#CCCCCC'"/>
<xsl:element name="fo:block"/>
</xsl:copy>
<xsl:value-of select="'#{end}'"/>
</xsl:template>

<xsl:template match="barcode:barcode/@message">
<xsl:attribute name="message">
<xsl:value-of select="."/>
<xsl:if test="contains(.,'idQuestionnaire')">
<xsl:value-of select="' - #page-id#'"/>
</xsl:if>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
4 changes: 2 additions & 2 deletions src/main/resources/xslt/inputs/ddi/source-fixed.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@
<xsl:for-each select="$conditional-text//d:Expression/r:Command">
<xsl:if test="r:OutParameter/r:ID = $variable">
<Variable>
<xsl:sequence select="r:Binding/r:SourceParameterReference/r:ID"/>
<xsl:value-of select="r:Binding/r:SourceParameterReference/r:ID"/>
</Variable>
</xsl:if>
</xsl:for-each>
Expand All @@ -824,7 +824,7 @@
<xsl:variable name="ordered-variables">
<xsl:for-each select="$formula-variables//Variable">
<xsl:sort select="string-length(.)" order="descending"/>
<xsl:copy-of select="."/>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="distinct-values($ordered-variables)"/>
Expand Down
Loading

0 comments on commit adb06bc

Please sign in to comment.