|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: transform to 2-row table
Hi Robert.
Try this:
<xsl:template match="PAGE">
<table>
<xsl:apply-templates select="GROUP[position() mod 2=1]">
<xsl:sort select="@PRIORITY"/>
</xsl:apply-templates>
</table>
</xsl:template>
<xsl:template match="GROUP">
<tr>
<!-- if the two columns are treated the same way, you might consider
changing the next line with <xsl:apply-templates select="."
mode="next"/>. This way you only need to change in one place -->
<td><xsl:value-of select="@NAME"/></td>
<xsl:apply-templates select="following-sibling::GROUP[1]"
mode="next"/>
</tr>
</xsl:template>
<xsl:template match="GROUP" mode="next">
<td><xsl:value-of select="@NAME"/></td> <!-- or do whatever you like
inside the column -->
</xsl:template>
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Robert
Sösemann
Sent: Thursday, November 07, 2002 6:34 PM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: transform to 2-row table
Who can help?
How can I easily transform this xml structure of <GROUP>s of articles
into a 2-row HTML Table?
<?xml version="1.0" encoding="ISO-8859-1"?>
<PAGE>
<GROUP NAME="Articles from this month" PRIORITY="1">
<ABSTRACT ID="2">
...
</ABSTRACT>
<ABSTRACT ID="1" >
...
</ABSTRACT>
</GROUP>
<GROUP NAME="Articles from this October" PRIORITY="2">
...
</GROUP>
<GROUP NAME="Articles from this September" PRIORITY="3">
...
</GROUP>
<GROUP NAME="Articles from this September" PRIORITY="4">
...
</GROUP>
...more groups
</PAGE>
The xsl should arrange the <GROUP>s due to their priority attribute
value. E.g. 1 2
4 5
6 an so on
<TABLE>
<TR>
<TD>Articles from this month</TD>
<TD>Articles from this October</TD>
</TR>
<TR>
<TD>Articles from this September</TD>
<TD>Articles from this September</TD>
</TR>
</TABLE>
Greetings Robert
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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








