Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


populating xml using xslt horizontally

Posted on 2006-07-18
Medium Priority
Last Modified: 2012-05-05
I'm trying to transform XML file sample below:

   <month name="June">
       <item id="one">45</item>
       <item id="two">65</item>
       <item id="three">94</item>
   <month name="July">
       <item id="one">34</item>
       <item id="two">23</item>
       <item id="three">12</item>

to HTML table below:

      June      July
one      34      44
two      12      23
three      45      76

using XSLT.   However I am not able to populate 'June' and 'July' in the HTML table.
Question by:kaushalshah
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

owenli27 earned 2000 total points
ID: 17135859
Try use this XSL to see if it work:

<?xml version="1.0" encoding="ISO-8859-1" ?>  
 <xsl:stylesheet version="1.0" xmlns:xsl="">
 <xsl:output method="html" />
 <xsl:template match="/">
  <td> </td>
  <xsl:for-each select="ticket/month">
  <td> <xsl:value-of select="@name"/></td>

  <xsl:for-each select="ticket/month">
  <xsl:for-each select="item">
   <xsl:if test="'one'=@id">
   <td> <xsl:value-of select="." /></td>

  <xsl:for-each select="ticket/month">
  <xsl:for-each select="item">
   <xsl:if test="'two'=@id">
   <td> <xsl:value-of select="." /></td>

  <xsl:for-each select="ticket/month">
  <xsl:for-each select="item">
   <xsl:if test="'three'=@id">
   <td> <xsl:value-of select="." /></td>

Author Comment

ID: 17168017
awesome.   just one question;  in '<td> <xsl:value-of select="." /></td>', what is select="."?

Expert Comment

ID: 17168888
It is an expression to tell xsl to return and output the current element value

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question