Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #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?


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.