xsl-list
[Top] [All Lists]

[Fwd: Re: occurrences and axis]

2003-11-18 08:20:16


-------- Original Message --------
Subject:        Re: [xsl] occurrences and axis
Date:   Tue, 18 Nov 2003 15:12:46 +0100
From:   Elena Pierazzo <pierazzo(_at_)ital(_dot_)unipi(_dot_)it>
To:     xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
References: <E392EEA75EC5F54AB75229B693B1B6A705290705(_at_)esebe018(_dot_)ntc(_dot_)nokia(_dot_)com>



Hi,
Here a sample of the file without omitting the intermediate nodes from the root to the point I want to indagate:
<teiCorpus.2>
<text>
 <body>
<div1 type="punto di inchiesta">
   <termEntry id="Li_LI">
    <tig>
     <term type="localita">Livorno</term>
     <descrip type="provincia">LIVORNO</descrip>
    </tig>
   </termEntry>
   <div2 type="scuola">
    <termEntry id="LC_Li_NP">
     <tig>
      <term type="nome">Niccolini - Palli</term>
      <descrip type="tipo">Liceo Classico</descrip>
      <ptr type="punto" target="Li_LI"/>
     </tig>
    </termEntry>
    <div3 type="parlante">
     <termEntry>
      <tig>
   <term type="identificativo parlante" id="Li4">Li4</term>
<descrip type="sesso">m</descrip> <descrip type="nascita">Toscana</descrip> <descrip type="residenza">in loco</descrip> <descrip type="profPadre"></descrip> <descrip type="profMadre"></descrip> <descrip type="internet">si</descrip> <descrip type="consVern">si</descrip> <descrip type="consLing">si</descrip> <ptr type="scuola" target="LC_Li_NP"/>
    <ptr type="punto" target="Li_LI" />
      </tig>
     </termEntry>
     <div4 type="forma">
      <termEntry id="LCLiNPLi4M3Alt">
     <tig>
    <term grammRef="vai+1ips2" type="forma">non ci stai dentro</term>
    <ptr type="parlante" target="Li4" />
    <ptr type="domanda" target="M3Alt" />
    <ptr gradRef="it_co" type="tipo lessicale" target="STARE"/>
      <ptr gradRef="it_co" type="tipo lessicale" target="DENTRO"/>
    <ptr type="area tematica" target="alt" />
         <ptr gradRef="gerg_inn" type="voce" target="matto"/>
    </tig>
      </termEntry>
     </div4>
</div3>
</div2>
</div1>
</body>
</text>
</teiCorpus.2>


and that is my full stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output encoding="iso-8859-1" method="html"/>
<xsl:template match="/">
</xsl:template>
<xsl:key name="term" match="term[(_at_)type='forma']" use="."/>
<xsl:template match="teiCorpus.2/text/body/div1/div2/div3/div4/termEntry/tig">
<html>
<body>
<xsl:if test="child::ptr[(_at_)gradRef='gerg_inn']">
<xsl:for-each select="child::term[(_at_)type='forma'][not(.=preceding::term)]">
     <xsl:sort select="."/><br />
     <xsl:value-of select="concat(.,' ',count(key('term',.)))"/>
     <xsl:text>
</xsl:text>
   </xsl:for-each>
 </xsl:if>
</body>
</html>
 </xsl:template>
</xsl:stylesheet>

My wished output is:
occurence 25
occurence 23
occurence 17
occurence 16
occurrence 8
...
occurence 1

where the number 25, 24, ...1 represent the number of time the occurence is found.
Thank you again
Elena



Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com wrote:

Hi,

<xsl:if test="child::ptr[attribute::gradRef='gerg_inn']">

or e.g.

<xsl:if test="ptr/@gradRef = 'gerg_inn'">



but it did not work :-(

In your previous email you wrote:

<xsl:template match="/">
</xsl:template>

<xsl:key name="term" match="term[(_at_)type='forma']" use="."/>

 <xsl:template match="//tig" name="pippo">
<html>
<body>
<xsl:if test="child::ptr[gradRef='gerg_inn']">
<xsl:for-each select="child::term[(_at_)type='forma'][not(.=preceding::term)]">
     <xsl:sort select="."/><br />
     <xsl:value-of select="concat(.,' ',count(key('term',.)))"/>
     <xsl:text>
</xsl:text>
   </xsl:for-each>
 </xsl:if>
</body>
</html>

 </xsl:template>
</xsl:stylesheet>

Does your stylesheet contain the topmost template, i.e. the template for root node 
that doesn't do anything? Anyhow, the test works for me with the source you 
showed—could you show a complete (i.e. self-contained) example and stylesheet 
that doesn't work, and what is the desired output?

Cheers,

Jarno - DJ Xii vs DJ Todd: Bait & Switch Vol. 1

XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list





XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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