Skip to content

Commit

Permalink
tables_only.xsl updated for #245
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed May 21, 2024
1 parent 4e55620 commit 332aad7
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/main/resources/tables_only.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@

<xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>

<xsl:template match="/">
<xsl:variable name="xml">
<xsl:apply-templates />
</xsl:variable>
<xsl:apply-templates select="xalan:nodeset($xml)" mode="check_empty_elements"/>
</xsl:template>

<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
Expand All @@ -28,7 +35,8 @@
local-name() = 'sections' or
local-name() = 'annex' or
local-name() = 'indexsect'
]//*[local-name() = 'p' or
]//*[local-name() = 'clause' or
local-name() = 'p' or
local-name() = 'ul' or
local-name() = 'ol' or
local-name() = 'note' or
Expand Down Expand Up @@ -131,4 +139,21 @@
</xsl:for-each>
</xsl:template>

<xsl:template match="@*|node()" mode="check_empty_elements">
<xsl:copy>
<xsl:apply-templates select="@*|node()" mode="check_empty_elements"/>
</xsl:copy>
</xsl:template>

<xsl:template match="*[local-name() = 'preface' or local-name = 'sections' or local-name() = 'annex' or local-name() = 'indexsect'][not(clause)]" mode="check_empty_elements">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:variable name="ns" select="namespace-uri()"/>
<xsl:element name="clause" namespace="{$ns}">
<xsl:element name="title" namespace="{$ns}">Clause</xsl:element>
</xsl:element>
<xsl:apply-templates mode="check_empty_elements"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

0 comments on commit 332aad7

Please sign in to comment.