|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: "Simple" matrix transformation
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/doc/group">
<HTML><BODY>
<xsl:variable name="salesp" select="*"/>
<TABLE width='100%'>
<TR>
<TH> corner </TH>
<xsl:for-each select="$salesp"> <xsl:sort/>
<TH>
<xsl:value-of select="@salesperson"/>
</TH>
</xsl:for-each>
</TR>
<!-- XSL cookbook required. See page 275 of Michael's book -->
<xsl:for-each
select="group/item[ not (./@date = preceding::item/@date) ]">
<xsl:sort/>
<xsl:variable name="date" select="@date"/>
<TR>
<TD align='center'> <xsl:value-of select="$date"/> </TD>
<xsl:for-each select="$salesp"> <xsl:sort/>
<xsl:variable name="sales" select="@salesperson"/>
<TD align='center'>
<xsl:value-of
select="/doc/group/group/item
@date = $date and
../@salesperson = $sales
]"
/>
</TD>
</xsl:for-each>
</TR>
</xsl:for-each>
</TABLE>
</BODY></HTML>
</xsl:template>
</xsl:stylesheet>
---- result:
<HTML>
<BODY>
<TABLE width="100%">
<TR>
<TH> corner </TH><TH>alex</TH><TH>lynn</TH><TH>terry</TH>
</TR>
<TR>
<TD align="center">1999-07-15</TD><TD align="center">1200</TD><TD
align="center">1500</TD><TD align="center">2000</TD>
</TR>
<TR>
<TD align="center">2000-07-15</TD><TD align="center">1000</TD><TD
align="center">2000</TD><TD align="center">3000</TD>
</TR>
</TABLE>
</BODY>
</HTML>
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
|

Cart








