xsl-list
[Top] [All Lists]

Re: Selecting the Latest Date

2006-02-07 22:42:22
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(_at_)sanmargroup(_dot_)com 
<jeb501(_at_)sanmargroup(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--