Subject: Re: [xsl] Trying to identify the 3 highest sales results From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 07 Jan 2008 15:57:05 -0500 |
<!-- the 'place' variables are bound to Boolean values --> <xsl:variable name="first-place" select="$higher-count = 0"/> <xsl:variable name="second-place" select="$higher-count = 1"/> <xsl:variable name="third-place" select="$higher-count = 2"/>
<!-- change the tagging here to fit --> <agent> <xsl:attribute name="place"> <xsl:choose> <xsl:when test="$first-place">First</xsl:when> <xsl:when test="$second-place">Second</xsl:when> <xsl:when test="$third-place">Third</xsl:when> <xsl:otherwise>Rest</xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:value-of select="agent"/> </agent> </xsl:template>
I hope this helps, Wendell
Hello xsl-list,
I'm using Xslt(v1.0) to convert an Xml(v1.0) file to Xhtml for browser display
and trying to add a visual for the top 3 sales result.
i.e. trying to build <td class="first">9</td> <td class="second">6</td> <td class="third">3</td> The CSS class translates to <img src="boldGold.gif" alt="first" /> I'm Ok with building the Xhtml and adding CSS classes
When the row template is being processed. How Do you Identify if it's the 1st, 2nd or 3rd highest sales figure? Typically there are 200-300 salesmen results per calculation and the Xml by design,is pre sorted by salesman name.
Xslt shard <xsl:template match="row"> <tr> ... <td> <xsl:value-of select="sales"/> </td> </tr> </xsl:template>
Xml shard <table calculated="08W021T07:16"> <row> <agent>Fred Smith</agent> ... <sales>6</sales> </row> <row> <agent>George Jones</agent> ... <sales>9</sales> </row> <row> <agent>George Jones Jr</agent> ... <sales>1</sales> </row> <row> <agent>Karina Houseman</agent> ... <sales>3</sales> </row> </table>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Trying to identify the 3 , Dimitre Novatchev | Thread | [xsl] newbie xsl apply-templates ne, John Saylor |
Re: [xsl] Trying to identify the 3 , Dimitre Novatchev | Date | RE: [xsl] document() function and e, Wendell Piez |
Month |