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

Re: RE: HTML Table

Subject: Re: RE: HTML Table
From: v.kavanagh@xxxxxxxxxxxx
Date: Wed, 3 Sep 2003 17:24:02 +0000
stylesheet border
Hi,

Thanks for your replies.

This is the HTML table I?m trying to draw;
<TABLE>
  <TR>
    <TD>abc123</TD>
    <TD>abc345</TD>
    <TD>abc567</TD>
    <TD>abc543</TD>
    <TD>abc987</TD>
    <TD>abc912</TD>
  </TR>
  <TR>
    <TD></TD>
    <TD>429</TD>
    <TD></TD>
    <TD>430</TD>
    <TD></TD>
    <TD>105</TD>
  </TR>
  <TR>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD>434</TD>
    <TD></TD>
    <TD></TD>
    </TR>
</TABLE>

This is an example of the xml;
<root>
 <box BoxID="123" BoxRef="abc123"/>
 <box BoxID="1234" boxref="abc345">
 <tin tinid="429" tinqty="5" tintype="tin"/>
 </box>
 <box BoxID="1267" boxref="abc567"/>
 <box BoxID="1812" boxref="abc543">
 <tin tinid="430" tinqty="10"/>
 <tin tinid="434" tinqty="12"/>
 </box>
 <box BoxID="1813" boxref="abc987"/>
 <box BoxID="1816" boxref="abc912">
 <tin tinid="105" tinqty="10"/>
 </box>
</root>

This is my attempt at the stylesheet:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">		
		<table border="1">
<TR>
<xsl:for-each select="//box">
    <TH><xsl:value-of select="@boxref" /></TH>
</xsl:for-each>
</TR>

<xsl:for-each select="//box">
<tr>
<xsl:for-each select="//box/tin">
<xsl:variable name="cur" select="//box/tin/@tinid"/>
<!--<xsl:if test="not(node())"><td></td></xsl:if>-->
  <xsl:if test="//box/tin">
    <xsl:choose>
      <xsl:when test="//box/tin/@tinid">
        <td>
          <xsl:value-of select="@tinid"/>
        </td>
      </xsl:when>
      <xsl:otherwise>
        <td></td>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:if>
</xsl:for-each>
</tr>
 </xsl:for-each>
</table>
  </xsl:template>
</xsl:stylesheet>


Many thanks,


Vince.

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



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.