Skip to content

Commit

Permalink
ISO19139 / Multilingual record / Set main language from CharacterStri…
Browse files Browse the repository at this point in the history
…ng if no PTFreeText match. Required for migration due to #2032.
  • Loading branch information
fxprunayre committed Oct 13, 2017
1 parent bd1793a commit aa4cfe5
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions schemas/iso19139/src/main/plugin/iso19139/layout/layout.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,11 @@
</xsl:if>
</xsl:variable>


<xsl:variable name="values">
<xsl:if test="$isMultilingualElement">
<xsl:variable name="text"
select="normalize-space(gco:CharacterString)"/>

<values>
<!--
Expand All @@ -271,13 +274,28 @@

<!-- and create field for none translated language -->
<xsl:for-each select="$metadataOtherLanguages/lang">
<xsl:variable name="code" select="@code"/>
<xsl:variable name="currentLanguageId" select="@id"/>
<xsl:if test="count($theElement/parent::node()/
gmd:PT_FreeText/gmd:textGroup/
gmd:LocalisedCharacterString[@locale = concat('#',$currentLanguageId)]) = 0">
<value ref="lang_{@id}_{$theElement/parent::node()/gn:element/@ref}"
lang="{@id}"></value>
</xsl:if>
<xsl:variable name="ptFreeElementDoesNotExist"
select="count($theElement/parent::node()/
gmd:PT_FreeText/*/
gmd:LocalisedCharacterString[
@locale = concat('#', $currentLanguageId)]) = 0"/>

<xsl:choose>
<xsl:when test="$ptFreeElementDoesNotExist and
$text != '' and
$code = $metadataLanguage">
<value ref="lang_{@id}_{$theElement/parent::node()/gn:element/@ref}"
lang="{@id}">
<xsl:value-of select="$text"/>
</value>
</xsl:when>
<xsl:when test="$ptFreeElementDoesNotExist">
<value ref="lang_{@id}_{$theElement/parent::node()/gn:element/@ref}"
lang="{@id}"></value>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</values>
</xsl:if>
Expand Down

0 comments on commit aa4cfe5

Please sign in to comment.