Wendell,
Indeed it's necessary if you wish to do more than list the values. For
example, count how many you have ...
<xsl:for-each-group select="//term[@xml:lang='zh'])" group-by=".">
<xsl:sort select="."/>
<p count="{count(current-group())}>
<xsl:value-of select="current-grouping-key()"/>
<xsl:text> </xsl:text>
</p>
</xsl:for-each-group>
Thank you! This would certainly be an attractive enhancement.
But this present code is generating an error in my <oXygen/>
The error is indicated as being in the line
<xsl:value-of select="current-grouping-key()"/>
and the error message is
"The value of attribute "count" associated with an element type "p" must
not contain the '<' character."
But the following seems to work:
<xsl:for-each-group select="//term[@xml:lang='zh']"
group-by=".">
<xsl:sort select="."/>
<p>
<xsl:value-of select="current-grouping-key()"/>
<xsl:value-of select="count(current-group())"/>
<xsl:text> </xsl:text>
</p>
</xsl:for-each-group>
I.e., it generates this kind of output:
<p>一切惑1 </p>
<p>一切惡趣1 </p>
<p>一切方便1 </p>
<p>一切時3 </p>
<p>一切有情1 </p>
<p>一切染1 </p>
<p>一切法5 </p>
<p>一切法中1 </p>
<p>一切煩惱11 </p>
<p>一切煩惱障1 </p>
<p>一切生1 </p>
But now that you've introduced this, I realize that I can sort by
frequency, using
<xsl:sort select="count(current-group())"/>
Great!
Chuck
It's a nice thing to show a workshop --
Cheers, Wendell
On Sun, Jun 12, 2016 at 8:43 AM, Charles Muller
acmuller(_at_)l(_dot_)u-tokyo(_dot_)ac(_dot_)jp
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>
wrote:
On 6/12/2016 9:36 PM, Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de wrote:
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>
OK, I'll try this as well. The following also does the trick:
<body>
<xsl:for-each select="//term[@xml:lang='zh'][not(preceding::node()=.)] ">
<xsl:sort select="."/>
<p><xsl:apply-templates/><xsl:text> </xsl:text></p>
</xsl:for-each>
</body>
I deeply appreciate your help. This was the last piece I needed to do a demo
of using TEI-XML + XSLT at an upcoming DH Workshop.
Regards,
Chuck
---------------------------
A. Charles Muller
Graduate School of Humanities and Sociology
Faculty of Letters
University of Tokyo
7-3-1 Hongō, Bunkyō-ku
Tokyo 113-8654, Japan
Office Phone: 03-5841-3735
Web Site: Resources for East Asian Language and Thought
http://www.acmuller.net
Twitter: @H_Buddhism
--
---------------------------
A. Charles Muller
Graduate School of Humanities and Sociology
Faculty of Letters
University of Tokyo
7-3-1 Hongō, Bunkyō-ku
Tokyo 113-8654, Japan
Office Phone: 03-5841-3735
Web Site: Resources for East Asian Language and Thought
http://www.acmuller.net
Twitter: @H_Buddhism
--~----------------------------------------------------------------
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
--~--