xsl-list
[Top] [All Lists]

Re: [xsl] Generating an index of terms in a TEI P5 book MS

2016-06-12 07:37:08
On 12.06.2016 14:33, Charles Muller 
acmuller(_at_)l(_dot_)u-tokyo(_dot_)ac(_dot_)jp wrote:

I wonder if there is a way to eliminate the doubled entries with XSLT?

As you seem to have access to XSLT 2.0, you could simply use

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xpath-default-namespace="http://www.tei-c.org/ns/1.0"; version="2.0">
    <xsl:template match="TEI">
        <html>
            <head/>
            <body>
        <xsl:for-each select="distinct-values(//term[@xml:lang='zh'])">
          <xsl:sort select="."/>
       <p><xsl:value-of select="."/><xsl:text> </xsl:text></p>
         </xsl:for-each>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

or replace the `for-each` you had with for-each-group select="//term[@xml:lang='zh']" group-by=".".
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>