|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: attribute list
Not sure why the subject is "attribute list", but... > <CUSTOMER> > <CUSTOMER_ID>0000000026</CUSTOMER_ID> > <COMPANY>Aero Atlanta Fl</COMPANY> > <NAME>Aero Atlanta Flying Club</NAME> > <MAILBOX></MAILBOX> > <STREET>P.O. Box 819</STREET> > <POSTCODE>30144</POSTCODE> > <CITY>Kennesaw,</CITY> > <PHONE></PHONE> > <FAX></FAX> > </CUSTOMER> > > > what i want to do is dynamically display the child elements > as headers in an html table, like this : > > <table> > <tr> > <td>CUSTOMER_ID</td><td>COMPANY</td><td>NAME</td><td>MAILBOX</ > td><td>STREET< > /td><td>POSTCODE</td><td>CITY</td><td>PHONE</td><td>FAX</td> > </tr> > <table> If all CUSTOMERs have the same set of child element names, you can just look at the first CUSTOMER and iterate through its child elements with something like this: <xsl:template match="/"> <table> <!-- header row --> <tr> <xsl:for-each select="//CUSTOMER[1]/*"> <td><xsl:value-of select="name()"/></td> </xsl:for-each> </tr> <xsl:for-each select="//CUSTOMER"> <!-- customer data row --> <tr> <xsl:for-each select="*"> <td><xsl:value-of select="."/></td> </xsl:for-each> </xsl:for-each> </table> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






