Skip to content

Commit

Permalink
feat: dynamic unit (#1155)
Browse files Browse the repository at this point in the history
- feat(dynamic unit): add ControlledVocabularyName='personalizedUnit' for dynamic Unit
- fix: get-unit for dynamic Unit (forgotten in previous branch's commit)
- chore: bump version
  • Loading branch information
BulotF authored and nsenave committed Dec 11, 2024
1 parent b0a14bf commit ff2512a
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>fr.insee.eno</groupId>
<artifactId>eno-core</artifactId>
<version>2.11.1</version>
<version>2.12.0</version>
<packaging>jar</packaging>

<name>Eno – Questionnaire generator</name>
Expand Down
12 changes: 12 additions & 0 deletions src/main/resources/xslt/inputs/pogues-xml/functions.fods
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,18 @@
</table:table-cell>
<table:table-cell table:number-columns-repeated="3"/>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enopogues:is-dynamic-unit</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell table:style-name="Default" office:value-type="string" calcext:value-type="string">
<text:p>xs:boolean</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>Returns if a unit is dynamic</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-value</text:p>
Expand Down
32 changes: 32 additions & 0 deletions src/main/resources/xslt/inputs/pogues-xml/templates.fods
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,38 @@
<text:p>Non dynamic Unit : returns the value corresponding to the Uri</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:Unit[../pogues:IsDynamicUnit=&apos;true&apos;]</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-unit</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>.</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>id-variable</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>Dynamic unit : returns the value, transformed with-tag</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:Unit</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>enopogues:is-dynamic-unit</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>../pogues:IsDynamicUnit=&apos;true&apos;</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Returns if a unit is dynamic</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>*</text:p>
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/xslt/outputs/ddi/models.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,12 @@
<xsl:param name="source-context" as="item()" tunnel="yes"/>
<xsl:variable name="unit" select="enoddi33:get-unit($source-context)"/>
<xsl:if test="not(normalize-space($unit) = ('',' '))">
<r:MeasurementUnit><xsl:value-of select="$unit"/></r:MeasurementUnit>
<r:MeasurementUnit>
<xsl:if test="enoddi33:is-dynamic-unit($source-context)">
<xsl:attribute name="ControlledVocabularyName">personalizedUnit</xsl:attribute>
</xsl:if>
<xsl:value-of select="$unit"/>
</r:MeasurementUnit>
</xsl:if>
</xsl:template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,18 @@
</table:table-cell>
<table:table-cell/>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>enoddi33:is-dynamic-unit</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>enopogues:is-dynamic-unit</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Returns if a unit is dynamic</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enoddi33:get-value</text:p>
Expand Down

0 comments on commit ff2512a

Please sign in to comment.