Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 30th, 2004, 07:15 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Entering data to dynamic table cells

I am using xsl to create reports in HTML and RTF from a textfile. I am using an xml mapping file in the following format.

<mappings>
        <mapping pos="0" name="title" type="Element" />
    <mapping pos="1" name="surname" type="Element" />
    <mapping pos="2" name="extsurname" type="Element" />
    <mapping pos="3" name="forename" type="Element" />
    <mapping pos="4" name="initial" type="Element" />
        <mapping pos="5" name="ref" type="Element" />
</mappings>

I have created the reports easily, but I have to create a title page, which includes listing the references in the report. I would like to display these in a dynamic table, as there will be an unknown quantity of referances used.

I have tried to produce a 5 columned table as follows but to no avail. It correctly creates the required rows, but I am not able to enter the data into the cells after the first value of the row.

<xsl:key name="ref-key" match="mappings" use="ref" />

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

I don't think it is possible to use following as i am not using nodes. Is there any other way to read through the variable while maintaing the correct position?




Similar Threads
Thread Thread Starter Forum Replies Last Post
Entering data into an SQL database jmsherry SQL Server 2000 3 July 24th, 2007 01:00 AM
help writing dynamic form data to dynamic table ublend SQL Server ASP 1 June 1st, 2007 08:09 AM
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
Pivot Table Dynamic Reference Data oyelesit Excel VBA 2 August 4th, 2006 07:28 AM
entering data Kelly Johnson Classic ASP Databases 1 August 7th, 2003 07:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.