xsl-list
[Top] [All Lists]

Cannot enter data into Dynamic Table cells

2004-07-01 05:19:01
I have looked through numerous mailing lists and forums but i am unable to find the solution i require, so hopefully there is someone who could help.

I am creating reports in HTML and RTF format from a flat file. This has been easily done, but I am also required to create a title page that lists unique references. I am able to get the unique references, but when i try to write them in my table, the incorrect field values are entered.

I am using an xml file to map the different elements required as follows:

<mappings root="RegistrationList" child="Registration" delimiter="">
        <mapping pos="0" length="4" name="title" type="Element" />
        <mapping pos="1" length="10" name="surname" type="Element" />
        <mapping pos="2" length="10" name="extsurname" type="Element" />
        <mapping pos="3" length="15" name="forename" type="Element" />
        <mapping pos="4" length="1" name="initial" type="Element" />
               <mapping pos="5" length="5" name="ref" type="Element" />
               <mapping pos="6" length="1" name="selind" type="Element" />
        <mapping pos="7" length="1" name="deadind" type="Element" />
        <mapping pos="8" length="1" name="tranind" type="Element" />
               <mapping pos="9" length="1" name="depind" type="Element" />
</mappings>


I am using the following code to get the unique references and trying to write them to a dynamic table. Instead of the references being entered, it writes the fields after i.e. values of selind,deadind,tranind,depind.

It does however put the correct amount of rows, and the correct reference value in the first cell of each row.

<xsl:key name="ref-key" match="ref" use="." />
<xsl:template match="/">
<xsl:variable name="unique-ref" select="/RegistrationList/Registration/ref[generate-id() = generate-id(key('ref-key', .))]" />
<table align="center" cellspacing="5" cellpadding="5">
        <xsl:for-each select="$unique-ref[position() mod 5 = 1]">
                <tr>
                        <td>
                                <xsl:value-of select="current()" />
                        </td>
<xsl:for-each select="current()[position()]/following::*[position() &lt; 5]">
                                <td>
                                        <xsl:value-of select="current()" />
                                </td>
                        </xsl:for-each>
                </tr>
        </xsl:for-each>
</table>
</xsl:template>


the problem seems to be the line :

<xsl:for-each select="current()[position()]/following::*[position() &lt; 5]">

I have also used

<xsl:for-each select="current()[position()]/following::$unique-ref[position() &lt; 5]">

but it only produces a blank page.

Please someone help as this has been driving me crazy, and there is probably a simple solution.

Thanks in advance

Colin

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo