473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XSL Tables Created depending on content entered

Im currently trying to come up with the xsl to create a table depending on how much info is in the xml file e.g. use one template that will work with multiple number of different table sizes.

the xml used is:
Expand|Select|Wrap|Line Numbers
  1. <table>
  2. <row> 
  3. <columnname>cell</columnname>
  4. <columnname>cell</columnname>
  5. </row>
  6. <row> <info>topcell</info><info>topcell</info>
  7. </row>
  8. <row> <info>topcell</info><info>topcell</info>
  9. </row>
  10. </table>
  11.  
and the xsl I'm using at the minute is:
Expand|Select|Wrap|Line Numbers
  1.   <xsl:template match="table">
  2.   <table width="200" border="1">
  3.   <tr><xsl:value-of select="columnname"/></tr>
  4.   <td><xsl:value-of select="info" /></td>
  5.   </table>
  6.   </xsl:template>
  7.  
to me it makes great sense that this should take the info from the columnname element and put it in the first row, then take the data from the info element and insert into the rows after that. can anyone see why this may not be working?

Thanks
Mar 5 '08 #1
1 1222
jkmyoung
2,057 Expert 2GB
Xpaths are not right. It looks like you're treating this almost as data islands (deprecated).

Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="table">
  2.   <table width="200" border="1">
  3.     <xsl:apply-templates/>
  4.   </table>
  5. </xsl:template>
  6.  
  7. <xsl:template match="row">
  8.   <tr>
  9.     <xsl:apply-templates/>
  10.   </tr>
  11. </xsl:template>
  12.  
  13. <xsl:template match="columnname">
  14.   <th><xsl:value-of select="."/></th>
  15. </xsl:template>
  16.  
  17. <xsl:template match="info">
  18.   <td><xsl:value-of select="."/></td>
  19. </xsl:template>
  20.  
Mar 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
54
by: Max Quordlepleen | last post by:
Apologies for the crossposting, I wasn't sure which of these groups to ask this in. I have been lurking in these groups for a week or so, trying to glean what I need to design a simple, clean...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
7
by: Wilhelm Kutting | last post by:
Hi again i want to replace the following layouttabel with css/xhtml: ---------------------------------- <table width="640" cellspacing="0"> <tr> <td valign="top">My Title</td> <td...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
1
by: jazzfeelings | last post by:
I have set up 2 tables one listing all our Agent's jobs and the other our other Customers. I have created a form to enter new jobs into our Customer table. I wanted to know if it is possible to...
2
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database,...
9
by: Blarneystone | last post by:
Hi, I am using VB.NET and trying to pull data from two different tables in the database. I am using what I think is standard code. But the data I am pulling is like the following: Table1...
4
by: psyvanz | last post by:
Im a college student, my program is a computerized enrollment system, Im using MS ACCESS database in connecting my VB6 program form. Inside i'd created two tables, named "tbstudentinfo" and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.