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

Need Help with XSL Multicolumn Item Display

Subject: Need Help with XSL Multicolumn Item Display
From: soporte@xxxxxxxxxxxx
Date: Sun, 17 Oct 2004 09:30:26 -0700 (PDT)
xsl multi column
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. I already
have the XSL with the respective table layout display, the only thing I
need is just to display 4 in a row so the page will be smaller and the
user won't have to scroll down and down to see all the items.. The
solution I need is like a row gallery (4 in a row) insead of a row list (1
in a row).

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>


This is the stylesheet of the XSL to display the items within an specific
table layout. I need to display with this table layout but 4 in a row. Now
this XSL just display one per row and is not usessfull for me because the
page will grow to much and then the users will have to srcoll down and
down, so if I can put 4 in a row the page size will decrease
significantly.

I hope someone can help me. Thanks Lot and best regards.


********************************************
<?xml version=3D"1.0" encoding=3D"UTF-8" ?>
<xsl:stylesheet version=3D"1.0"
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform">

<xsl:param name=3D"currentRecord" />
<xsl:param name=3D"pageSize" />

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

<xsl:template match=3D"/">
        <xsl:apply-templates select=3D"items/item">
        </xsl:apply-templates>
</xsl:template>

<xsl:template match=3D"item">
<table width=3D"115" border=3D"1" cellpadding=3D"0" cellspacing=3D"0">
   <!--DWLayoutTable-->
   <tr>
  =20
   <xsl:choose>
    <xsl:when test=3D"position() mod 2 =3D 1">
     <xsl:attribute name=3D"class">clsOdd</xsl:attribute>
    </xsl:when>
    <xsl:otherwise>
     <xsl:attribute name=3D"class">clsEven</xsl:attribute>
    </xsl:otherwise>
   </xsl:choose>

    <td width=3D"115" height=3D"99" valign=3D"top"><table =
width=3D"100%" border=3D"0"
cellpadding=3D"0" cellspacing=3D"0">
      <!--DWLayoutTable-->
      <tr>
       <td width=3D"12" height=3D"90"></td>
       <td width=3D"90" valign=3D"top">
               <a href=3D"{link}" target=3D"_blank"><img align=3D"middle" =
alt=3D"{title}"
style=3D"border: 1px solid #666666" border=3D"0" width=3D"90" =
height=3D"90"
src=3D"{image_url}"/></a>
       </td>
       <td width=3D"13"></td>
      </tr>
      <tr>
       <td height=3D"9"></td>
       <td></td>
       <td></td>
      </tr>
     </table>
    </td>
   </tr>
   <tr>
    <td height=3D"82" valign=3D"top"><table width=3D"100%" border=3D"0"
cellpadding=3D"0" cellspacing=3D"0">
      <!--DWLayoutTable-->
      <tr>
       <td width=3D"115" height=3D"63" valign=3D"top">
        <xsl:value-of select=3D"title"/>
        <a href=3D"{link}" target=3D"_blank"><br>m=E1s =
informaci=F3n<img
align=3D"middle" src=3D"tree/lens.gif" border=3D"0"/></br></a>
       </td>
      </tr>
      <tr>
        <xsl:if test=3D"mpago =3D 'Y'">
         <td height=3D"13" valign=3D"top"><img alt=3D"Pagalo en =
mensualidades..."
align=3D"middle" style=3D"border: 1px solid #666666" border=3D"0"
src=3D"images/amexvisamc.gif"/></td>
        </xsl:if>
        <xsl:if test=3D"mpago =3D 'N'">
         <td height=3D"13" valign=3D"top"><img align=3D"middle" =
border=3D"0"
src=3D"images/nomark.gif"/></td>
        </xsl:if>
      </tr>
    </table></td>
   </tr>
   <tr>
     <td height=3D"19" valign=3D"bottom" bgcolor=3D"#FFFF00" =
class=3D"precio">
      <font style=3D"color:#FF0000; font-weight:100"><b>
      <xsl:value-of select=3D"currency"/><xsl:value-of =
select=3D"price"/>
      </b></font>
     </td>
   </tr>
</table>
</xsl:template>

</xsl:stylesheet>
********************************************

I hope someone can help me. Thanks Lot and best regards.

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.