It sounds to me as if you are trying to do grouping: see
http://www.jenitennison.com/xslt/grouping for a guide on how to achieve
this.
Michael Kay
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Kaarle Kaila
Sent: 01 October 2003 20:38
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Creating index using xsl
hi,
I am rather new to this list but I have tried to look for an
answer to my problem from the FAQ. At least it seems I cannot
use a variable in a for-each loop to compare with the previous value.
I am looking into xslt to see how much I can use it to create
some genealogical reports and it seems that formatting of the
data might be ok and perhaps also creating teh indexes.
I have a simple xml-file at
http://www.kk-software.fi/kalle/xsl/koe.xml that creates a
simple index of the data it contains by using
http://www.kk-software.fi/kalle/xsl/tables.xsl and
http://www.kk-> software.fi/kalle/xsl/tables.css.
A
transformed html file
that contains also the table text exists at
http://www.kk-> software.fi/kalle/xsl/table.html. The texsts
are in Finnish
but have no meaning. The index as it is created by the xsl is
transformed also at
http://www.kk-> software.fi/kalle/xsl/resu1.html. At
http://www.kk-software.fi/kalle/xsl/resu2.html
you can see how I would want teh index to look. Of course with real data
there would be more than 1 table but so far I have experimented only
with one table.
Sorting in finnish/swedish order seems to be no problem but how to
combine the current name element with the previous is. I have tried to
use variables, I have tried to get hold of previous-sibling but not
succeeded. Can anybody out there help me with this. Can I do what I want
with xslt?? Here is still a code-sniplet from the xsl-file:
<xsl:for-each select="//name">
<xsl:sort order="ascending" lang="fi" select="@sur"/>
<xsl:sort order="ascending" lang="fi" select="@given"/>
<TR>
<TD align="left">
<!-- here I should check if the name is equal to previous name
if so then I would not create a new row but continue on previous
-->
<xsl:apply-templates/>
</TD><TD>
<xsl:value-of select="ancestor::table/@number"
/>
</TD>
</TR>
</xsl:for-each>
--
Kaarle Kaila
email: kaarle dot kaila at iki dot fi
www.iki.fi/kaila
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list