xsl-list
[Top] [All Lists]

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

2016-06-12 04:26:32
You say you want to build an index, but you don't say what should go in the 
index.

Extracting the terms is easy enough, but what other information do you want in 
the index?

Is there a requirement here to group multiple occurrences of the same term? If 
so, you want to do grouping rather than just sorting (which means your life 
would be much easier with XSLT 2.0).

Michael Kay
Saxonica

On 12 Jun 2016, at 05:08, Charles Muller 
acmuller(_at_)l(_dot_)u-tokyo(_dot_)ac(_dot_)jp 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Dear Colleagues,

I have a document written in TEI P5, for which I'd like to generate an index 
of words tagged as <term xml:lang="zh"> occurring anywhere throughout the 
<body> of the document, which means that the terms are occurring inside of 
<p>, which might be under <div2>, <div3>...<div7>.

I've been struggling with this for a few days with no success, so must after 
all ask for some help. I'm presently stuck at this stage:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
   <xsl:template match="TEI/text/body">
     <html>
     <head/>
      <body>
        <xsl:for-each select="//term[@xml:lang='zh'] ">
        <xsl:sort select="term[@xml:lang='zh']"/>
          <p><xsl:apply-templates/><xsl:text> </xsl:text></p>
          </xsl:for-each>
           </body>
       </html>
   </xsl:template>
</xsl:stylesheet>


Any pointers would be much appreciated!

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

--~----------------------------------------------------------------
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>