|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Display format across the page not down!
Hi all,
I am new to Xslt but fast getting the hang of things... The trouble is I have run into a problem regarding how the results of my .xsl file are display in the html page, basically the end result I want to achieve is to format the results across the page and not down it.. e.g. ![]() 1 2 3 4 5 6 7 8 9 and not .. ![]() 1 2 3 4 5 6 Hope you can help... here is the code I have so far: <?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html> <head> <title>Lets test this out</title> <style type="text/css"> .tname {font-family:Tahoma;font-size:14pt;font-weight:bold} .tdesc {font-family:Tahoma;font-size:1pt} .tsaletxt {font-family:Tahoma;font-size:14pt;font-weight:bold;color:gray;} .tprice {font-family:Tahoma;font-size:18pt;font-weight:bold;color:red;text-align:center} </style> </head> <body> <xsl:apply-templates select="/Offers/Offer[MerchantCategory= 'Fashion | Lingerie | Briefs'][Manufacturer='Sloggi']"> <xsl:sort select="Manufacturer" order="ascending"/> </xsl:apply-templates> </body> </html> </xsl:template> <xsl:template match="Offer"> <table border="1" cellpaddig="0" cellspacing="0" width="199"> <tr> <td width="166"> <a href="{ActionURL}"> <img src="{ReferenceImageURL}" width="86" height="117" alt="{OfferName}" /> </a> <div class="tdesc"> <xsl:value-of select="OfferName"/><br/><br/> </div> <div class="tprice"> Regular Price: <xsl:value-of select="RegularPrice"/><br/> </div> <xsl:if test="CurrentPrice < RegularPrice"> <div class="tsaletxt"> OUR SALE PRICE </div> <xsl:apply-templates select="CurrentPrice"/> </xsl:if> </td> </tr> </table> </xsl:template> </xsl:stylesheet> |
|
#2
|
||||
|
||||
|
If you "float" each table "left" with CSS then they will be next to each other. The added advantage here (though may be undesirable) is that they will float until they have no room left in the containing element. So if you're using 100% of the body, a user under 800x600 would get 4 accross, but a user with 1024x768 would get 5 accross -- IOW, the tables will fill the available space and then wrap for you automagically.
If that's not a viable solution for you, you need to use one table, end the row when you reach three cells, then continue it. You can use the "mod" expression in an <xsl:if> statement to determine if you're at the end of a row. Unfortunately I don't have time to work up an example for you. Sorry.
__________________
# Jeremy Explain your problem instead of asking how to do what you decided was the solution. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Display format across the page not down! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|