Below is a simple xsl that I am using to format some xml.  Xml as roont of
Entity then department then employee inside of of employee there is 3
elements of employeeID, employeefname and employeelname.

There is only one entity at this time, but two departments.

<entity>
    <department>
        <employee>
            <employeeid>1</employeeid>
            <employeefname>david</employeefname>
            <employeelname>brown</employeelname>
        </employee>
        ..........
      </department>

       <department>
        <employee>
            <employeeid>2</employeeid>
            <employeefname>dav</employeefname>
            <employeelname>browne</employeelname>
        </employee>
        ........
      </department>

The below xsl will loop over the first set of employees in the first
department, but will not loop over the next.  I know this has to be very
simple, but this is my first attempt at this stuff.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/">
  <html>
  <body>
    <h2>Report</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th align="left">EmployeeID</th>
        <th align="left">First Name</th>
  <th align="left">Last Name</th>
      </tr>
      <xsl:for-each select="Entity/department/employee">
      <tr>
      <td><xsl:value-of select="employeeid" /></td>
        <td><xsl:value-of select="employeefname" /></td>
  <td><xsl:value-of select="employeelname" /></td>
      </tr>
      </xsl:for-each>
  </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to