From 86c6f82bc97a61d69f4aa5a9e4b8d1583dc3cfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bulot?= Date: Mon, 4 Nov 2024 11:35:43 +0100 Subject: [PATCH] feat(pogues2ddi): table dynamic size defined with an expression (#1117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Première dimension des tableaux : refacto Pogues + tab dyn de longueur fixée par formule - suppression de @dynamic pour les dimensions autres que PRIMARY - @dynamic = 0 => @dynamic = NON_DYNAMIC - @dynamic = min-max => @dynamic = DYNAMIC_LENGTH avec les éléments MinLines et MaxLines - @dynamic = FIXED_LENGTH avec élément FixedLenth : en DDI, un élément ConditionForContinuation qui contient une formule * chore: bump version --------- Co-authored-by: Nicolas Senave --- pom.xml | 2 +- .../xslt/inputs/pogues-xml/functions.fods | 22 ++++- .../xslt/inputs/pogues-xml/source-fixed.xsl | 10 +-- .../xslt/inputs/pogues-xml/templates.fods | 82 ++++++++++++++++--- .../resources/xslt/outputs/ddi/models.xsl | 30 +++++-- .../pogues-xml2ddi/drivers.fods | 10 +-- .../pogues-xml2ddi/functions.fods | 38 +++++++-- 7 files changed, 156 insertions(+), 38 deletions(-) diff --git a/pom.xml b/pom.xml index b14070cd6..8284016ef 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ fr.insee.eno eno-core - 2.10.3-SNAPSHOT + 2.11.0-SNAPSHOT jar Eno – Questionnaire generator diff --git a/src/main/resources/xslt/inputs/pogues-xml/functions.fods b/src/main/resources/xslt/inputs/pogues-xml/functions.fods index 84e6d8c53..130f6d6bc 100644 --- a/src/main/resources/xslt/inputs/pogues-xml/functions.fods +++ b/src/main/resources/xslt/inputs/pogues-xml/functions.fods @@ -728,13 +728,31 @@ + + + enopogues:get-minimum-lines + + + + Returns the minimum lines for a dynamic table + + + + + enopogues:get-maximum-lines + + + + Returns the maximum lines for a dynamic table + + - enopogues:get-dynamic + enopogues:get-fixed-lines - Return the dynamic attribute of the pogues:Dimension. This value is used to compute positions in grids + Returns the formula for the fixed number of lines for a dynamic table diff --git a/src/main/resources/xslt/inputs/pogues-xml/source-fixed.xsl b/src/main/resources/xslt/inputs/pogues-xml/source-fixed.xsl index 12c2d042c..b53e5c2c9 100644 --- a/src/main/resources/xslt/inputs/pogues-xml/source-fixed.xsl +++ b/src/main/resources/xslt/inputs/pogues-xml/source-fixed.xsl @@ -214,12 +214,13 @@ - + + @@ -235,7 +236,7 @@ - + @@ -268,7 +269,6 @@ mode="enopogues:get-fake-dimension"> - @@ -285,7 +285,7 @@ - + @@ -302,7 +302,7 @@ select="concat($context/parent::pogues:Child/@id, '-secondDimension-fakeCL-1')"/> - + diff --git a/src/main/resources/xslt/inputs/pogues-xml/templates.fods b/src/main/resources/xslt/inputs/pogues-xml/templates.fods index faf877767..1c2b55c0a 100644 --- a/src/main/resources/xslt/inputs/pogues-xml/templates.fods +++ b/src/main/resources/xslt/inputs/pogues-xml/templates.fods @@ -819,17 +819,79 @@ - pogues:Dimension + pogues:Dimension[contains(@dynamic,'-')] + + + enopogues:get-minimum-lines - enopogues:get-dynamic + substring-before(@dynamic, '-') + + + + Returns the minimum lines for a dynamic table (old version) + + - @dynamic + pogues:Dimension[contains(@dynamic,'-')] + + + enopogues:get-maximum-lines + + + substring-after(@dynamic, '-') + + Returns the maximum lines for a dynamic table (old version) + + + + + pogues:Dimension[@dynamic='DYNAMIC_LENGTH'] + + + enopogues:get-minimum-lines + - Return the dynamic attribute of the pogues:Dimension. This value is used to compute positions in grids + pogues:MinLines + + + + Returns the minimum lines for a dynamic table (new version) + + + + + pogues:Dimension[@dynamic='DYNAMIC_LENGTH'] + + + enopogues:get-maximum-lines + + + pogues:MaxLines + + + + Returns the maximum lines for a dynamic table (new version) + + + + + pogues:Dimension[@dynamic='FIXED_LENGTH'] + + + enopogues:get-fixed-lines + + + pogues:FixedLength + + + with-tag + + + Returns the formula for the fixed number of lines for a dynamic table @@ -1808,7 +1870,7 @@ - pogues:Child[@questionType='TABLE' and not(pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0'])] + pogues:Child[@questionType='TABLE' and not(pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and (@dynamic != '0' and @dynamic != 'NON_DYNAMIC')])] enopogues:get-type @@ -1823,7 +1885,7 @@ - pogues:Child[@questionType='TABLE' and pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0']] + pogues:Child[@questionType='TABLE' and pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0' and @dynamic != 'NON_DYNAMIC']] enopogues:get-type @@ -2160,7 +2222,7 @@ - pogues:Variable[@xsi:type='CollectedVariableType' and (not(pogues:Scope) or pogues:Scope='') and //pogues:Child[pogues:Response/pogues:CollectedVariableReference=current()/@id][pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0']]] + pogues:Variable[@xsi:type='CollectedVariableType' and (not(pogues:Scope) or pogues:Scope='') and //pogues:Child[pogues:Response/pogues:CollectedVariableReference=current()/@id][pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0' and @dynamic != 'NON_DYNAMIC']]] enopogues:get-variable-group @@ -2175,7 +2237,7 @@ - pogues:Variable[@xsi:type='CollectedVariableType' and (not(pogues:Scope) or pogues:Scope='') and //pogues:Child[pogues:Response/pogues:CollectedVariableReference=current()/@id][not(pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0']) and not(@questionType='PAIRWISE')]] + pogues:Variable[@xsi:type='CollectedVariableType' and (not(pogues:Scope) or pogues:Scope='') and //pogues:Child[pogues:Response/pogues:CollectedVariableReference=current()/@id][not(pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0' and @dynamic != 'NON_DYNAMIC']) and not(@questionType='PAIRWISE')]] enopogues:get-variable-group @@ -2190,7 +2252,7 @@ - pogues:Variable[@xsi:type='CollectedVariableType' and (not(pogues:Scope) or pogues:Scope='') and //pogues:Child[pogues:ClarificationQuestion//pogues:CollectedVariableReference=current()/@id][not(pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0'])]] + pogues:Variable[@xsi:type='CollectedVariableType' and (not(pogues:Scope) or pogues:Scope='') and //pogues:Child[pogues:ClarificationQuestion//pogues:CollectedVariableReference=current()/@id][not(pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0' and @dynamic != 'NON_DYNAMIC'])]] enopogues:get-variable-group @@ -2318,7 +2380,7 @@ - pogues:Child[@xsi:type='QuestionType' and @questionType='TABLE' and pogues:ResponseStructure/pogues:Dimension[@dimensionType='PRIMARY' and @dynamic != '0']] + pogues:Child[@xsi:type='QuestionType' and @questionType='TABLE' and pogues:ResponseStructure/pogues:Dimension[@dimensionType='PRIMARY' and @dynamic != '0' and @dynamic != 'NON_DYNAMIC']] enopogues:get-scope-loops diff --git a/src/main/resources/xslt/outputs/ddi/models.xsl b/src/main/resources/xslt/outputs/ddi/models.xsl index 6e1cd722b..c436ca23b 100644 --- a/src/main/resources/xslt/outputs/ddi/models.xsl +++ b/src/main/resources/xslt/outputs/ddi/models.xsl @@ -1426,7 +1426,7 @@ - + @@ -1443,7 +1443,7 @@ - + @@ -2423,12 +2423,26 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/xslt/transformations/pogues-xml2ddi/drivers.fods b/src/main/resources/xslt/transformations/pogues-xml2ddi/drivers.fods index e7eac7de6..13eb8e984 100644 --- a/src/main/resources/xslt/transformations/pogues-xml2ddi/drivers.fods +++ b/src/main/resources/xslt/transformations/pogues-xml2ddi/drivers.fods @@ -454,7 +454,7 @@ - pogues:Child[@xsi:type='QuestionType' and @questionType='TABLE' and not(pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0'])] + pogues:Child[@xsi:type='QuestionType' and @questionType='TABLE' and not(pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0' and @dynamic != 'NON_DYNAMIC'])] QuestionTable @@ -465,7 +465,7 @@ - pogues:Child[@xsi:type='QuestionType' and @questionType='TABLE' and pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0']] + pogues:Child[@xsi:type='QuestionType' and @questionType='TABLE' and pogues:ResponseStructure/pogues:Dimension[@dimensionType="PRIMARY" and @dynamic != '0' and @dynamic != 'NON_DYNAMIC']] QuestionDynamicTable @@ -601,7 +601,7 @@ - pogues:Dimension[@dimensionType='PRIMARY' and @dynamic != '0'] + pogues:Dimension[@dimensionType='PRIMARY' and @dynamic != '0' and @dynamic != 'NON_DYNAMIC'] RosterDimension @@ -612,7 +612,7 @@ - pogues:Dimension[@dimensionType='MEASURE' and @dynamic='0'] + pogues:Dimension[@dimensionType='MEASURE' and not(@dynamic!='0' and @dynamic != 'NON_DYNAMIC')] UnknownDimension @@ -623,7 +623,7 @@ - pogues:Dimension[@dimensionType=('PRIMARY','SECONDARY') and @dynamic='0'][pogues:CodeListReference] + pogues:Dimension[@dimensionType=('PRIMARY','SECONDARY') and not(@dynamic!='0' and @dynamic != 'NON_DYNAMIC')][pogues:CodeListReference] CodeDomainDimension diff --git a/src/main/resources/xslt/transformations/pogues-xml2ddi/functions.fods b/src/main/resources/xslt/transformations/pogues-xml2ddi/functions.fods index add099246..4c0d72c5a 100644 --- a/src/main/resources/xslt/transformations/pogues-xml2ddi/functions.fods +++ b/src/main/resources/xslt/transformations/pogues-xml2ddi/functions.fods @@ -735,15 +735,39 @@ - - enoddi33:get-dynamic + + enoddi33:get-minimum-lines - - enopogues:get-dynamic + + enopogues:get-minimum-lines - - This is used to implement the code of booleans if this return something + + Returns the minimum lines for a dynamic table + + + + + enoddi33:get-maximum-lines + + + + enopogues:get-maximum-lines + + + Returns the maximum lines for a dynamic table + + + + + enoddi33:get-fixed-lines + + + + enopogues:get-fixed-lines + + + Returns the formula for the fixed number of lines for a dynamic table @@ -1605,7 +1629,7 @@ - +