I'm stuck on an xPath expression and how to render it in XSLT. I'd love some help.
SOURCE
A flat stack of "item" elements:
<list>
<item outline="3" name="grumpy"/>
<item outline="5" name="monarchists"/>
<item outline="9" name="dispatch"/>
<item outline="3" name="parkour"/>
<item outline="3" name="elves"/>
<item outline="9" name="hunting"/>
<item outline="9" name="clueless"/>
<item outline="3" name="xPath"/>
<item outline="2" name="newbs"/>
</list>
TEST
Is the value of the preceding element's "outline" attribute greater than the value of the current element's "outline" attribute?
If so, change the value of the current "item" element "outline" attribute to 1.
FAILED XPATH
I can't get past the initial test ...
<xsl:when test="preceding::item[1][@outline > @outline]">
DESIRED OUTPUT
<list>
<item outline="1" name="grumpy"/>
<item outline="5" name="monarchists"/>
<item outline="9" name="dispatch"/>
<item outline="1" name="parkour"/>
<item outline="3" name="elves"/>
<item outline="9" name="hunting"/>
<item outline="9" name="clueless"/>
<item outline="1" name="xPath"/>
<item outline="1" name="newbs"/>
</list>
Please suggest the XSLT too.
Thanks!