RE: [xsl] transform to 2-row table

Subject: RE: [xsl] transform to 2-row table
From: "Américo Albuquerque" <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Thu, 7 Nov 2002 19:48:39 -0000
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: [xsl] 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


Current Thread