Re: [xsl] Minimum value

Subject: Re: [xsl] Minimum value
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 20 Sep 2002 16:14:31 -0600 (MDT)
Avula, Raj wrote:
> 	My xml is like this...
> 
> 	<a>
> 		<value>34</value>
> 	</a>
> 	<a>
> 		<value>23</value>
> 	</a>
> 	<a>
> 		<value>56</value>
> 	</a>
> 	<a>
> 		<value>22</value>
> 	</a>
> 
> Is there a way to find out the "minimum" of "value" with out using xsl:sort
> function?

Marrow provided the answer, but just out of curiosity,
why would you not want to use xsl:sort?

> is there a way in which I can form a string like 34:23:56:22: using xsl?

<xsl:variable name="series">
  <xsl:for-each select="a/value">
    <xsl:value-of select="concat(.,':')"/>
  </xsl:for-each>
</xsl:variable>

You can then use the $series result tree fragment in expressions as if it were
a string. If you need an actual string, use a new variable:

<xsl:variable name="seriesString" select="string($series)"/>

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread