|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Filtering Numeric Output with Changing Parameter
Hello Tim,
the stylesheet is relative simple as you can see. You only have to process the nodes step by step: (added a <root> element in in- and output) <xsl:template match="root">
<root>
<xsl:apply-templates select="stock[1]"/>
</root>
</xsl:template><xsl:template match="stock">
<xsl:variable name="threshold" select="1"/>
<xsl:copy-of select="."/>
<xsl:apply-templates select="following-sibling::stock
[price >= current()/price + $threshold
or price <= current()/price - $threshold][1]"/>
</xsl:template>The first stock must be selected. The next stock, that shell be selected, is either "price >= current()/price + $threshold" or "price <= current()/price - $threshold", again we will only have the first one, that fulfills one of both conditions. I declared $threshold as variable, you can use it hard-coded in the expression or as parameter too. Regards, Joerg Tim Lewis wrote: I'd like to take a pile of numeric data and filter it down to a smaller pile by selecting for output only values that change by more than a threshold amount from the beginning value. If a value gets selected for XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








