[xsl] Need Help with XSL Multicolumn Table

Subject: [xsl] Need Help with XSL Multicolumn Table
From: soporte@xxxxxxxxxxxx
Date: Thu, 14 Oct 2004 08:43:26 -0700 (PDT)
Hello,

I have an XML with data like the following and I need to display this info
in a multicolumn table. Suppose I have 20 items, I want to display in each
row 4 items with the respective title, price, currency, etc.

Hope anyone can help me with this.. I will appreciate so much the help.

<items>
<item id="2545">
<title>Something a</title>
<price>1,500</price>
<image_url>pic1.jpg</image_url>
<currency>$</currency>
<mpago>N</mpago>
<listing_features>
<highlight>Y</highlight>
</listing_features>

</item>

<item id="2546">
<title>Something b</title>
<price>1,583</price>
<image_url>pic2.jpg</image_url>
<currency>US$</currency>
<mpago>Y</mpago>
<listing_features>
<highlight>Y</highlight>
</listing_features>

</item>
<item id="2580">
<title>Something c</title>
<price>700</price>
<image_url>pic3.jpg</image_url>
<currency>$</currency>
<mpago>N</mpago>
<listing_features>
<highlight>N</highlight>
</listing_features>

</item>
......
</items>



I want to show 4 tables like this one in each row.
Im also pasting here the code of the table in html:

Here is the html code of the table I would like each item to have.

***************************

<table width="115" border="0" cellpadding="0" cellspacing="0">
   <!--DWLayoutTable-->
   <tr>
    <td width="115" height="99" valign="top"><table width="100%"
border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
       <td width="12" height="90"></td>
       <td width="90" valign="top">** Here the image **</td>
       <td width="13"></td>
      </tr>
      <tr>
       <td height="9"></td>
       <td></td>
       <td></td>
      </tr>
     </table>
    </td>
   </tr>
   <tr>
    <td height="82" valign="top"><table width="100%" border="0"
cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
       <td width="115" height="63" valign="top">
        ** here the title ** </td>
      </tr>
      <tr>
        <td height="13" valign="top">** here mpago **</td>
      </tr>
    </table></td>
   </tr>
   <tr>
     <td height="19" valign="bottom" bgcolor="#FFFF00" class="precio">
      ** here price ** <font style="color:#FF0000;
font-weight:100"><b></b></font></td>
   </tr>
</table>

***************************************

And here is the current XSL that displays the info each item in a row, but
I dont want that way I need in the format of the table above.


<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:param name="currentRecord" />
	<xsl:param name="pageSize" />

	<xsl:variable name="maxRecords" select="count(items)" />

	<xsl:template match="/response/listing/items/item">

 <table border="0" class="row" width="550" cellspacing="0" cellpadding="1"
bordercolor="gainsboro">
        <tr class="row">

         <xsl:choose>
        <xsl:when test="position() mod 2 = 1">
							<xsl:attribute name="class">clsOdd</xsl:attribute>
						</xsl:when>
						<xsl:otherwise>
							<xsl:attribute name="class">clsEven</xsl:attribute>
						</xsl:otherwise>
					</xsl:choose>

				 <td class="image" width="17%"><a href="{link}" target="_blank"><img
align="middle" alt="{title}" style="border: 1px solid #666666"
border="0" width="90" height="90" src="{image_url}"/></a></td>
				  <td class="value" width="45%"><xsl:value-of select="title"/><a
href="{link}" target="_blank"><br>mas informacisn<img align="middle"
src="tree/lens.gif" border="0"/></br></a></td>
                <td class="precio" width="16%"><xsl:value-of
select="currency"/><xsl:value-of select="price"/></td>

      <xsl:if test="mpago = 'Y'">
        <td class="image" width="14%"><img alt="Pagalo en
mensualidades..." align="middle" style="border: 1px solid #666666"
border="0" src="images/amexvisamc.gif"/></td>
      </xsl:if>
      <xsl:if test="mpago = 'N'">
<td class="image" width="14%"><img align="middle" border="0"
src="images/nomark.gif"/></td>
      </xsl:if>
                <td class="value" width="5%">
<xsl:for-each select="listing_features">
      <xsl:if test="highlight = 'Y'">
      <xsl:attribute name='style'>
                        <xsl:text>color:red</xsl:text>
                        </xsl:attribute>
<xsl:value-of select="photo"/>
      </xsl:if>
      </xsl:for-each>
      </td>
       </tr>
   <tr><td class="row"></td></tr>
		</table>
	</xsl:template>
</xsl:stylesheet>


I appreciate so much your help and hope you can help me.

Best Regards and thanks a lot,

Alex. V.

Current Thread