xsl-list
[Top] [All Lists]

Re: HTML Table

2003-09-03 01:34:03
am I missing something?  unless what you wrote was just a hypothetical and 
you just looked over the fact that you were using the attribute selector to 
select a nodes value...  your using '@SubA1' (etc...) to access the value of 
'SubA1' when you should just be using 'SubA1'...

I apologize for assuming that this wasn't a typo but it was fairly obvious 
so I thought I would eliminate this part of the problem first...

Let me know if you need further help...

M.


----- Original Message ----- 
From: <v(_dot_)kavanagh(_at_)ntlworld(_dot_)com>
To: <XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Wednesday, September 03, 2003 2:21 AM
Subject: [xsl] HTML Table




Hello,

I'm trying to create a table from an xml file.

The xml is similar to:

<A1>
  <subA1 />
  <subA2 />
  <subA3 />
</A1>
<B1>
</B1>
<C1>
  <subC1 />
  <subC2 />
</C1>

The table I'm trying to create is:

<TABLE>
  <TR>
    <TD><xsl:value-of select="@A1"/></TD>
    <TD><xsl:value-of select="@B1"/></TD>
    <TD><xsl:value-of select="@C1"/></TD></TR>
  <TR>
    <TD><xsl:value-of select="@subA1"/></TD>
    <TD></TD>
    <TD><xsl:value-of select="@subC1"/></TD>
  </TR>
  <TR>
    <TD><xsl:value-of select="@subA2"/></TD>
    <TD></TD>
    <TD><xsl:value-of select="@subC1"/></TD>
 </TR>
 <TR>
     <TD><xsl:value-of select="@subA3"/></TD>
     <TD></TD>
     <TD></TD>
 </TR>
</TABLE>

I have tried :

        <table border="1" cellspacing="0">
          <!--table header cells -->
          <tr>
            <tr>Load</tr>
            <xsl:for-each select="root/data">
              <th>
                <xsl:value-of select="@Ref"/>

              </th>
            </xsl:for-each>
          </tr>
        <!-- Generate a row for each sub element -->
        <xsl:for-each select="root/data">
<xsl:for-each select="sub">
          <tr>
          <xsl:choose>
          <xsl:when test="not(node())"/>
          <td></td>
          </xsl:when>
          <xsl:otherwise>
<xsl:value-of select="@sub"/>
              <input type="button" onClick="alert(@sub)"></input>
      </xsl:otherwise>
          </xsl:choose>
          </tr>
          </xsl:for-each>
      </table>

I am also tring to pass the value of @sub to a script function.

Many thanks,

Vince.

-----------------------------------------
Email provided by http://www.ntlhome.com/



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



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



<Prev in Thread] Current Thread [Next in Thread>