Skip to content

Commit

Permalink
keyword metadata now removes duplicates and is sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
bobstayton committed Jun 3, 2020
1 parent 7207533 commit ee371b7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 0 additions & 4 deletions xsl/fo/axf.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
version='1.0'>

<xsl:key name="keywords"
match="d:keyword[normalize-space(.) != '']"
use="normalize-space(.)" />

<xsl:template name="axf-document-information">

<xsl:variable name="authors" select="(//d:author|//d:editor|
Expand Down
4 changes: 4 additions & 0 deletions xsl/fo/docbook.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@

<xsl:key name="id" match="*" use="@id|@xml:id"/>

<xsl:key name="keywords"
match="d:keyword[normalize-space(.) != '']"
use="normalize-space(.)" />

<!-- ==================================================================== -->

<xsl:template match="*">
Expand Down
5 changes: 4 additions & 1 deletion xsl/fo/fop1.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@
<!-- Keywords -->
<xsl:if test="//d:keyword">
<pdf:Keywords>
<xsl:for-each select="//d:keyword">
<xsl:for-each
select="//d:keyword[normalize-space(.) != '']
[count(. | key('keywords', normalize-space(.))[1]) = 1]">
<xsl:sort select="normalize-space(.)"/>
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
Expand Down
5 changes: 4 additions & 1 deletion xsl/fo/xep.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@
<xsl:element name="rx:meta-field">
<xsl:attribute name="name">keywords</xsl:attribute>
<xsl:attribute name="value">
<xsl:for-each select="//d:keyword">
<xsl:for-each
select="//d:keyword[normalize-space(.) != '']
[count(. | key('keywords', normalize-space(.))[1]) = 1]">
<xsl:sort select="normalize-space(.)"/>
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
Expand Down

0 comments on commit ee371b7

Please sign in to comment.