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

Grouping Problem

Subject: Grouping Problem
From: "Alistair Rodrigues" <alistair.rodrigues@xxxxxxxxx>
Date: Tue, 7 Nov 2006 15:24:01 +0300
grouping problem
Hi there,

This is my XML File:
<?xml version="1.0" encoding="UTF-8"?>
<acclist>
   <acc>
       <code>3709</code>
       <name>Hotel 3709</name>
       <location>
           <destination>
               <code>Dest1</code>
               <name>dest 1</name>
           </destination>
           <zone>
               <code>zone1</code>
               <name>zone 1</name>
           </zone>
       </location>
       <category>
           <code>4sta</code>
           <name>4 STARS</name>
       </category>
       <room>
           <code>TPL.SU</code>
           <name>TRIPLE SUPERIOR</name>
           <occupancy>
               <adults>3</adults>
               <children>0</children>
               <rooms>1</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>99.96</price>
           </cost>
       </room>
       <room>
           <code>DBL.SU</code>
           <name>DOUBLE/ TWIN SUPERIOR</name>
           <occupancy>
               <adults>2</adults>
               <children>0</children>
               <rooms>1</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>65.00</price>
           </cost>
       </room>
       <room>
           <code>TPL.ST</code>
           <name>TRIPLE STANDARD</name>
           <occupancy>
               <adults>3</adults>
               <children>0</children>
               <rooms>1</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>128.98</price>
           </cost>
       </room>
       <room>
           <code>DBL.ST</code>
           <name>DOUBLE/ TWIN STANDARD</name>
           <occupancy>
               <adults>2</adults>
               <children>0</children>
               <rooms>1</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>99.96</price>
           </cost>
       </room>
       <room>
           <code>DBL.SU</code>
           <name>DOUBLE/ TWIN SUPERIOR</name>
           <occupancy>
               <adults>1</adults>
               <children>0</children>
               <rooms>2</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>70.94</price>
           </cost>
       </room>
       <room>
           <code>DBL.ST</code>
           <name>DOUBLE/ TWIN STANDARD</name>
           <occupancy>
               <adults>1</adults>
               <children>0</children>
               <rooms>2</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>99.96</price>
           </cost>
       </room>
   </acc>
   <acc>
       <code>725</code>
       <name>Hotel 725</name>
       <location>
           <destination>
               <code>dest1</code>
               <name>dest 1</name>
           </destination>
           <zone>
               <code>zone3</code>
               <name>zone 3</name>
           </zone>
       </location>
       <category>
           <code>3sta</code>
           <name>3 STARS</name>
       </category>
       <room>
           <code>TPL.SU</code>
           <name>TRIPLE SUPERIOR</name>
           <occupancy>
               <adults>3</adults>
               <children>0</children>
               <rooms>1</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>97.81</price>
           </cost>
       </room>
       <room>
           <code>DBL.SU</code>
           <name>DOUBLE/ TWIN SUPERIOR</name>
           <occupancy>
               <adults>2</adults>
               <children>0</children>
               <rooms>1</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>65.56</price>
           </cost>
       </room>
       <room>
           <code>SGL.SU</code>
           <name>SINGLE SUPERIOR</name>
           <occupancy>
               <adults>1</adults>
               <children>0</children>
               <rooms>2</rooms>
           </occupancy>
           <cost>
               <board>
                   <code>HD</code>
                   <name>BED AND BREAKFAST</name>
               </board>
               <currency>USD</currency>
               <price>56.96</price>
           </cost>
       </room>
   </acc>
</acclist>


This is XSL File:


<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
   <xsl:output method="html" omit-xml-declaration="yes"/>
   <xsl:template match="text()">
       <xsl:value-of select="." />
   </xsl:template>
   <xsl:template match="acclist/acc">
           <xsl:variable name="HotelCode" select="code"/>
           <br/>
           <table width="100%" border="0" class="TableBorders">
                <xsl:for-each select="room">
                   <xsl:sort order="ascending" data-type="text"
select="cost/board/code"/>
                   <xsl:sort order="descending" data-type="text"
select="substring-after(code,'.')"/>
                   <xsl:sort order="ascending" data-type="number"
select="occupancy/adults"/>
                   <xsl:sort order="ascending" data-type="number"
select="occupancy/children"/>
                   <xsl:sort order="ascending" data-type="number"
select="occupancy/rooms"/>

                   <xsl:variable name="rtype" select="code"/>
                   <tr class="TableData">
                       <td colspan="2"><xsl:value-of select="name"/></td>
                       <td width="31%"></td>
                       <td width="13%"></td>
                   </tr>
                       <xsl:for-each select="cost">
                           <xsl:variable name="amt" select="price" />
                           <xsl:variable name="famt"
select="format-number($amt, '###,###,###.##')"/>
                           <xsl:variable name="curr" >
                               <xsl:choose>
                                   <xsl:when
test="currency='EUR'"><xsl:text></xsl:text></xsl:when>
                                   <xsl:when
test="currency='USD'"><xsl:text>$</xsl:text></xsl:when>
                                   <xsl:when
test="currency='GBP'"><xsl:text>#</xsl:text></xsl:when>
                                   <xsl:when
test="currency='YEN'"><xsl:text>%</xsl:text></xsl:when>
                                   <xsl:otherwise><xsl:value-of
select="currency"/></xsl:otherwise>
                               </xsl:choose>
                           </xsl:variable>
                           <tr class="TableData">
                               <td width="48%"></td>
                               <td width="8%"><xsl:value-of
select="board/code"/></td>
                               <td><xsl:value-of
select="$curr"/><xsl:text> </xsl:text><xsl:value-of
select="$famt"/></td>
                               <td></td>
                           </tr>
                       </xsl:for-each>
               </xsl:for-each>
           </table>
   </xsl:template>
</xsl:stylesheet>

The file is currently displaying like:

<br><table width="100%" border="0" class="TableBorders">
<tr class="TableData">
<td colspan="2">DOUBLE/ TWIN SUPERIOR</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 70.94</td>
<td></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">RO</td>
<td>$ 79.96</td>
<td></td>
</tr>
<tr class="TableData">
<td colspan="2">DOUBLE/ TWIN SUPERIOR</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 65</td>
<td></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">RO</td>
<td>$ 62</td>
<td></td>
</tr>
<tr class="TableData">
<td colspan="2">TRIPLE SUPERIOR</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 99.96</td>
<td></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">RO</td>
<td>$ 99.96</td>
<td></td>
</tr>
<tr class="TableData">
<td colspan="2">DOUBLE/ TWIN STANDARD</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 99.96</td>
<td></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">RO</td>
<td>$ 99.96</td>
<td></td>
</tr>
<tr class="TableData">
<td colspan="2">DOUBLE/ TWIN STANDARD</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 99.96</td>
<td></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">RO</td>
<td>$ 79.96</td>
<td></td>
</tr>
<tr class="TableData">
<td colspan="2">TRIPLE STANDARD</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 128.98</td>
<td></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">RO</td>
<td>$ 102</td>
<td></td>
</tr>
</table>
   <br><table width="100%" border="0" class="TableBorders">
<tr class="TableData">
<td colspan="2">SINGLE SUPERIOR</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 56.96</td>
<td></td>
</tr>
<tr class="TableData">
<td colspan="2">DOUBLE/ TWIN SUPERIOR</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 65.56</td>
<td></td>
</tr>
<tr class="TableData">
<td colspan="2">TRIPLE SUPERIOR</td>
<td width="31%"></td>
<td width="13%"></td>
</tr>
<tr class="TableData">
<td width="48%"></td>
<td width="8%">HD</td>
<td>$ 97.81</td>
<td></td>
</tr>
</table>

I had made the XSL to display each room type(i.e. room/code)
separately & separate it in an ascending order of board
type(i.e.board/code) and later Adults, Children & rooms. As shown
above in the HTML Code above. But i cant separate the Board type(i.e.
Board/code)

I Now want the data to display like:

<table width="100%" border="0" class="TableBorders">
 <tr class="TableData">
   <td colspan="4"><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0"
CELLPADDING="0">
       <TR>
         <TD WIDTH="14%">&nbsp;</TD>
         <TD WIDTH="34%">DOUBLE/ TWIN SUPERIOR</TD>
         <TD WIDTH="19%" ALIGN="RIGHT">$ 70.94</TD>
         <TD WIDTH="33%">&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>DOUBLE/ TWIN SUPERIOR</TD>
         <TD ALIGN="RIGHT">$ 65.00</TD>
         <TD>&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>TRIPLE SUPERIOR</TD>
         <TD ALIGN="RIGHT">$ 99.96</TD>
         <TD>&nbsp;</TD>
       </TR>
     </TABLE></td>
 </tr>
   <tr class="TableData">
     <td width="30%"></td>
     <td width="37%">HD</td>
     <td WIDTH="18%">$ 235.90</td>
     <td WIDTH="15%">&nbsp;</td>
   </tr>
 <tr class="TableData">
   <td colspan="4"><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0"
CELLPADDING="0">
       <TR>
         <TD WIDTH="14%">&nbsp;</TD>
         <TD WIDTH="34%">SINGLE STANDARD</TD>
         <TD WIDTH="19%" ALIGN="RIGHT">$ 99.96</TD>
         <TD WIDTH="33%">&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>DOUBLE/ TWIN STANDARD</TD>
         <TD ALIGN="RIGHT">$ 99.96</TD>
         <TD>&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>TRIPLE STANDARD</TD>
         <TD ALIGN="RIGHT">$128.98</TD>
         <TD>&nbsp;</TD>
       </TR>
     </TABLE></td>
 </tr>
   <tr class="TableData">
     <td width="30%"></td>

   <td width="37%">HD</td>
   <td>$ 328.90</td>
     <td>&nbsp;</td>
   </tr>
	<tr class="TableData">
   <td colspan="4"><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0"
CELLPADDING="0">
       <TR>
         <TD WIDTH="14%">&nbsp;</TD>
         <TD WIDTH="34%">DOUBLE/ TWIN SUPERIOR</TD>
         <TD WIDTH="19%" ALIGN="RIGHT">$ 79.96</TD>
         <TD WIDTH="33%">&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>DOUBLE/ TWIN SUPERIOR</TD>
         <TD ALIGN="RIGHT">$ 62.00</TD>
         <TD>&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>TRIPLE SUPERIOR</TD>
         <TD ALIGN="RIGHT">$ 99.96</TD>
         <TD>&nbsp;</TD>
       </TR>
     </TABLE></td>
 </tr>
   <tr class="TableData">
     <td width="30%"></td>

<td width="37%">RO</td>

   <td WIDTH="18%">$ 241.92</td>
     <td WIDTH="15%">&nbsp;</td>
   </tr>
 <tr class="TableData">
   <td colspan="4"><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0"
CELLPADDING="0">
       <TR>
         <TD WIDTH="14%">&nbsp;</TD>
         <TD WIDTH="34%">SINGLE sTANDARD</TD>
         <TD WIDTH="19%" ALIGN="RIGHT">$ 79.96</TD>
         <TD WIDTH="33%">&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>DOUBLE/ TWIN STANDARD</TD>
         <TD ALIGN="RIGHT">$ 62.00</TD>
         <TD>&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>TRIPLE STANDARD</TD>
         <TD ALIGN="RIGHT">$ 99.96</TD>
         <TD>&nbsp;</TD>
       </TR>
     </TABLE></td>
 </tr>
   <tr class="TableData">
     <td width="30%"></td>
     <td width="37%">RO</td>
     <td>$ 241.92</td>
     <td>&nbsp;</td>
   </tr>
</table>
<BR><table width="100%" border="0" class="TableBorders">
 <tr class="TableData">
   <td colspan="4"><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0"
CELLPADDING="0">
       <TR>
         <TD WIDTH="14%">&nbsp;</TD>
         <TD WIDTH="34%">DOUBLE/ TWIN SUPERIOR</TD>
         <TD WIDTH="19%" ALIGN="RIGHT">$ 56.96</TD>
         <TD WIDTH="33%">&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>DOUBLE/ TWIN SUPERIOR</TD>
         <TD ALIGN="RIGHT">$ 65.56</TD>
         <TD>&nbsp;</TD>
       </TR>
       <TR>
         <TD>&nbsp;</TD>
         <TD>TRIPLE SUPERIOR</TD>
         <TD ALIGN="RIGHT">$ 97.81</TD>
         <TD>&nbsp;</TD>
       </TR>
     </TABLE></td>
 </tr>
   <tr class="TableData">
     <td width="30%"></td>
     <td width="37%">HD</td>

   <td WIDTH="18%">$ 220.33</td>
     <td WIDTH="15%">&nbsp;</td>
   </tr>
</table>

i want that the superior rooms should be in one group and the standard
in one group.and i also want to group all the room types belonging to
a particular boardtype in one boardtype group.

i know wat i want but i cant get it. Please help me!!

Regards,

Alistair Rodrigues.

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.