Skip to content

Commit

Permalink
Merge pull request #321 from metanorma/feature/xslt-update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Nov 1, 2024
2 parents bbbf7a0 + a8f641e commit bda0270
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions lib/isodoc/cc/cc.standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -9870,6 +9870,29 @@
<!-- END definition -->
<!-- ========== -->

<xsl:variable name="reviews_">
<xsl:for-each select="//*[local-name() = 'review'][@from]">
<xsl:copy>
<xsl:copy-of select="@from"/>
<xsl:copy-of select="@id"/>
</xsl:copy>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>

<xsl:template name="addReviewHelper">
<!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
<xsl:variable name="curr_id" select="@id"/>
<xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
<xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
<fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
</xsl:if>
<!-- <fo:block>
<curr_id><xsl:value-of select="$curr_id"/></curr_id>
<xsl:copy-of select="$reviews"/>
</fo:block> -->
</xsl:template>

<!-- main sections -->
<xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">

Expand All @@ -9878,6 +9901,8 @@

<xsl:call-template name="sections_element_style"/>

<xsl:call-template name="addReviewHelper"/>

<xsl:apply-templates/>
</fo:block>

Expand Down Expand Up @@ -9918,6 +9943,7 @@

<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
Expand Down Expand Up @@ -9954,6 +9980,8 @@

<xsl:call-template name="refine_clause_style"/>

<xsl:call-template name="addReviewHelper"/>

<xsl:apply-templates/>
</fo:block>
</xsl:template>
Expand Down Expand Up @@ -10006,6 +10034,23 @@

<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>

<xsl:if test="1 = 1">
<xsl:choose>
<!-- if there isn't the attribute '@from', then -->
<xsl:when test="$id_from = ''">
<fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
</xsl:when>
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
<fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
</xsl:when>
<xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
<fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
</xsl:when>
</xsl:choose>
</xsl:if>

<xsl:if test="1 = 2">
<xsl:choose>
<!-- if there isn't the attribute '@from', then -->
<xsl:when test="$id_from = ''">
Expand All @@ -10019,6 +10064,7 @@
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
</xsl:when>
</xsl:choose>
</xsl:if>

</xsl:template>

Expand Down

0 comments on commit bda0270

Please sign in to comment.