[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: attribute list

Subject: RE: attribute list
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Mon, 31 Jan 2000 13:49:51 -0700
attribute list
Not sure why the subject is "attribute list", but...

>       <CUSTOMER_ID>0000000026</CUSTOMER_ID>
>       <COMPANY>Aero Atlanta Fl</COMPANY>
>       <NAME>Aero Atlanta Flying Club</NAME>
>       <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="/">
    <!-- header row -->
      <xsl:for-each select="//CUSTOMER[1]/*">
        <td><xsl:value-of select="name()"/></td>
    <xsl:for-each select="//CUSTOMER">
      <!-- customer data row -->
        <xsl:for-each select="*">
          <td><xsl:value-of select="."/></td>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.