I ran your stylesheet and it worked for me, but I had
to close your entity tag and change your xpath from
"Entity/department/employee" to
"entity/department/employee". But I can't see anything
that would cause it to work only for the first
employees, unless you changed something when you
posted to the list.

Also, a word of advice: xslt has a different
programming "style" associated with it called
functional programming, which is different from the
usual procedural programming in languages such as cf.
People coming from a procedural background are likely
to be familiar with loops so they overuse
<xsl:for-each> rather than <xsl:template>. It gets the
job done, but you'll find that using <xsl:template>
leads to more robust and more easily modifiable code,
once you get used to that way of thinking.
--- David Brown <[EMAIL PROTECTED]> wrote:
> 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

Get the mailserver that powers this list at 
http://www.coolfusion.com

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

Reply via email to