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

Re: Selecting the Latest Date

Subject: Re: Selecting the Latest Date
From: jeb501@xxxxxxxxxxxxxxx
Date: Wed, 8 Feb 2006 16:22:13 +0530
latest date
I am using dd.mm.yyyy format only, anyway the earlier stylesheet also gave
me correct results.

Thanks for your time spent for me.

Regards
Eugene



                                                                           
             Mukul Gandhi                                                  
             <gandhi.mukul@gma                                             
             il.com>                                                    To 
                                       xsl-list@xxxxxxxxxxxxxxxxxxxxxx     
             08.02.2006 04:24                                           cc 
             PM                                                            
                                                                   Subject 
                                       Re:  Selecting the Latest Date 
             Please respond to                                             
             xsl-list@xxxxxxxx                                             
              lberrytech.com                                               
                                                                           
                                                                           
                                                                           




Sorry, I found a bug in my previous answer. The right stylesheet is
(assuming you are writing date as DD.MM.YYYY)

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

<xsl:template match="/">
     <html>
       <body>
         <h4>Test Report</h4>
           <table border="1" cellpadding="4" cellspacing="0">
              <tr bgcolor="#9acd32">
                <th>Ref</th>
                <th>Date</th>
                <th>Qty</th>
                <th>S Date</th>
              </tr>
              <xsl:for-each select="data/items">
               <tr>
                 <td>
                    <xsl:value-of select="ref" />
                 </td>
                 <td>
                    <xsl:value-of select="pdate" />
                 </td>
                 <td align="right">
                    <xsl:value-of select="qty" />
                 </td>
                 <td>
                   <xsl:for-each select="date">
                 <xsl:sort
select="concat(substring-after(substring-after(.,'.'),'.'),
substring-before(substring-after(.,'.'),'.'),
substring-before(.,'.'))" order="descending" data-type="number" />
                 <xsl:if test="position() = 1">
                   <xsl:value-of select="." />
                 </xsl:if>
                   </xsl:for-each>
                 </td>
              </tr>
            </xsl:for-each>
          </table>
        </body>
      </html>
</xsl:template>
</xsl:stylesheet>

Regards,
Mukul

On 2/8/06, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:
> Hi Eugene,
>  I think that this should work
>
> <xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
>   <xsl:template match="/">
>     <html>
>       <body>
>         <h4>Test Report</h4>
>           <table border="1" cellpadding="4" cellspacing="0">
>              <tr bgcolor="#9acd32">
>                <th>Ref</th>
>                <th>Date</th>
>                <th>Qty</th>
>                <th>S Date</th>
>              </tr>
>              <xsl:for-each select="data/items">
>               <tr>
>                 <td>
>                    <xsl:value-of select="ref" />
>                 </td>
>                 <td>
>                    <xsl:value-of select="pdate" />
>                 </td>
>                 <td align="right">
>                    <xsl:value-of select="qty" />
>                 </td>
>                 <td>
>                 <xsl:for-each select="date">
>             <xsl:sort select="translate(., '.', '')" order="descending"
> data-type="number" />
>             <xsl:if test="position() = 1">
>               <xsl:value-of select="." />
>             </xsl:if>
>                 </xsl:for-each>
>                 </td>
>              </tr>
>            </xsl:for-each>
>          </table>
>        </body>
>      </html>
>    </xsl:template>
> </xsl:stylesheet>
>
> Regards,
> Mukul
>
> On 2/8/06, jeb501@xxxxxxxxxxxxxxx <jeb501@xxxxxxxxxxxxxxx> wrote:
> > Mukul,
> >
> > Thanks for the lighting response,
> >
> > I am already using the below stylesheet to get my required output in
html
> > files.
> >
> > I like to pick the value of Date node which is largest of the three,
which
> > i like to keep it in the
> >
> > last column of my html sheet.
> >
> >
> >
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> >    - <xsl:stylesheet version="1.0" xmlns:xsl="
> >    http://www.w3.org/1999/XSL/Transform">
> >      - <xsl:template match="/">
> >        - <html>
> >          - <body>
> >             <h4>Test Report</h4>
> >            - <table border="1" cellpadding="4" cellspacing="0">
> >              - <tr bgcolor="#9acd32">
> >                 <th>Ref</th>
> >                 <th>Date</th>
> >                 <th>Qty</th>
> >                 <th>S Date</th>
> >             </tr>
> >              - <xsl:for-each select="data/items">
> >                - <tr>
> >                  - <td>
> >                     <xsl:value-of select="ref" />
> >                 </td>
> >                  - <td>
> >                     <xsl:value-of select="pdate" />
> >                 </td>
> >                  - <td align="right">
> >                     <xsl:value-of select="qty" />
> >                 </td>
> >                  <td>
> >                  the selected value should come here...
> >                  What xsl syntax i have to use here...
> >
> >                  </td>
> >               </tr>
> >             </xsl:for-each>
> >           </table>
> >         </body>
> >       </html>
> >     </xsl:template>
> >   </xsl:stylesheet>
> >
> >  Thanks again.
> >
> >  Regards
> >  Eugene

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-2011 All Rights Reserved.