[xsl] FMPro, XSL eliminate dup display help needed

Subject: [xsl] FMPro, XSL eliminate dup display help needed
From: scottz@xxxxxxx
Date: Tue, 3 Aug 2004 18:32:55 GMT
Howdy all,

I've just started my first XSL project and I've been stuck on this problem for a
number of hours.

Below is a sample of some data from a database I'm exporting

<?xml version="1.0" encoding="UTF-8" ?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult";;>
<ERRORCODE>0</ERRORCODE>
<PRODUCTBUILD="06/13/2002" NAME="FileMaker Pro" VERSION="6.0v1"/>
<DATABASE DATEFORMAT="d/M/yyyy" LAYOUT="" NAME="RespiteOptionsDatabase.fp5"
RECORDS="195" TIMEFORMAT="h:mm:ss a"/>
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="title" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="publisher" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="printing" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="cover" TYPE="TEXT"/>
</METADATA>
<RESULTSET FOUND="2">
<ROW MODID="1" RECORDID="35020">
<COL><DATA>a title1</DATA></col>
<COL><DATA>Baen</DATA></col>
<COL><DATA>1</DATA></col>
<COL><DATA>Hardcover</DATA></col>
</ROW>
<ROW MODID="1" RECORDID="35020">
<COL><DATA>a title1</DATA></col>
<COL><DATA>Ace</DATA></col>
<COL><DATA>2</DATA></col>
<COL><DATA>Hardcover</DATA></col>
</ROW>
<ROW MODID="2" RECORDID="35020">
<COL><DATA>a title2</DATA></col>
<COL><DATA>Baen</DATA></col>
<COL><DATA>3</DATA></col>
<COL><DATA>Hardcover</DATA></col>
</ROW>
<ROW MODID="2" RECORDID="35020">
<COL><DATA>b title2</DATA></col>
<COL><DATA>Ace</DATA></col>
<COL><DATA>4</DATA></col>
<COL><DATA>Hardcover</DATA></col>
</ROW>
</RESULTSET>
</FMPXMLRESULT>

Here is what I'm trying to get it to look like, with each item in a different
td element.  When the first letter of the title changes from a -> b-> c, I'd 
like to add <a name="a"></a> near the title, if possible.

a title1
   Baen 1 Hardcover
   Aces 2 Hardcover
a title2
   Baen 3 Hardcover
b title2
   Ace 4 Hardcover

Here's some of the stylesheet I've tried.  This is the first xslt stuff I've 
done some I'm certain a bunch of it is not the best way to do stuff.  And, 
it's not doing what I want, cause I can't figure out when I've changed titles 
and when they've stayed the same.

<tr>
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<xsl:attribute name="class">styleEven</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">styleOdd</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="posRow" select="position()" />
<xsl:for-each select="fmp:COL">
<xsl:variable name="posCol" select="position()" />
<xsl:choose>
<xsl:when test="/*/*/fmp:FIELD[$posCol]/@NAME = 'BookTitle'">
<xsl:variable name="currentTitle" select="fmp:DATA" />
<xsl:if test="$posRow > 1">
<td class="data">pre sib != 1::<xsl:value-of
select="/*/fmp:ROW[$posRow-1]/fmp:FIELD[$posCol]/fmp:DATA"/>::</td>
</xsl:if>
<xsl:if test="$posRow = 1">
<td class="data">pre sib::<xsl:value-of
select="/*/fmp:ROW[$posRow]/fmp:FIELD[$posCol]/fmp:DATA"/>::</td>
</xsl:if>
</xsl:when>
</xsl:choose>
<td class="data">
<xsl:value-of select="fmp:DATA"/>
</td>
</xsl:for-each>
</tr>

And
help?

Current Thread