[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

[Fwd: Re: occurrences and axis]

Subject: [Fwd: Re: [xsl] occurrences and axis]
From: Elena Pierazzo <pierazzo@xxxxxxxxxxxxx>
Date: Tue, 18 Nov 2003 16:20:16 +0100
elena pierazzo


-------- Original Message --------
Subject: Re: [xsl] occurrences and axis
Date: Tue, 18 Nov 2003 15:12:46 +0100
From: Elena Pierazzo <pierazzo@xxxxxxxxxxxxx>
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
References: <E392EEA75EC5F54AB75229B693B1B6A705290705@xxxxxxxxxxxxxxxxxxxxxx>




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[@type='forma']" use="."/>
<xsl:template match="teiCorpus.2/text/body/div1/div2/div3/div4/termEntry/tig">
<html>
<body>
<xsl:if test="child::ptr[@gradRef='gerg_inn']">
<xsl:for-each select="child::term[@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.Elovirta@xxxxxxxxx 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[@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[@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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.