RE: attribute list

Subject: RE: attribute list
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Mon, 31 Jan 2000 13:49:51 -0700
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:

Current Thread