Skip to content

Commit

Permalink
docx2mn.xsl updated, normative references items processing added, #144
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed May 21, 2022
1 parent 991147a commit 874c15c
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/main/resources/docx2mn.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,12 @@
<!-- ============================= -->
<!-- Bibliography entry processing -->
<!-- ============================= -->
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'BiblioEntry0']">

<!-- style RefNorm is using for Normative References,
style BiblioEntry0 is using for bibliography -->
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'BiblioEntry0' or w:pPr/w:pStyle/@w:val = 'RefNorm']">

<xsl:variable name="bib_style" select="w:pPr/w:pStyle/@w:val"/>

<!-- Example: * [[[ISO712,ISO 712]]], _Cereals and cereal products - Determination of moisture content - Reference method_ -->

Expand Down Expand Up @@ -839,13 +844,24 @@
</xsl:when>
<xsl:otherwise>
<xsl:text>[[[</xsl:text>
<xsl:text>bibref</xsl:text>
<xsl:choose>
<xsl:when test="$bib_style = 'BiblioEntry0'"><xsl:text>bibref</xsl:text></xsl:when>
<xsl:otherwise>ref</xsl:otherwise>
</xsl:choose>

<xsl:choose>
<xsl:when test="$bibitem/bibnumber">
<xsl:value-of select="$bibitem/bibnumber"/>
</xsl:when>
<xsl:otherwise>
<xsl:number count="w:p[w:pPr/w:pStyle/@w:val = 'BiblioEntry0']"/>
<xsl:choose>
<xsl:when test="$bib_style = 'BiblioEntry0'">
<xsl:number count="w:p[w:pPr/w:pStyle/@w:val = 'BiblioEntry0']"/>
</xsl:when>
<xsl:otherwise>
<xsl:number count="w:p[w:pPr/w:pStyle/@w:val = 'RefNorm']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:text>]]], </xsl:text>
Expand All @@ -858,16 +874,14 @@
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'^\[\](\s|\h)*(.*)$','$2')"/>
</xsl:otherwise>
</xsl:choose>




<xsl:text>&#xa;&#xa;</xsl:text>
</xsl:if>
</xsl:template>


<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'BiblioEntry0']/w:r[w:rPr/w:rStyle]/w:t">
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'BiblioEntry0' or w:pPr/w:pStyle/@w:val = 'RefNorm']//w:r[w:rPr/w:rStyle]/*[self::w:t or self::w:insText or self::w:delText]">
<xsl:variable name="style" select="ancestor::w:r[1]/w:rPr/w:rStyle/@w:val"/>
<xsl:element name="{$style}">
<xsl:apply-templates/>
Expand Down

0 comments on commit 874c15c

Please sign in to comment.