XSLT If nested node attributes values are less than 800

shina

New Member
Given this XML\[code\] <ContentBlock> <Content> <QuickStatus Balance="0" Credits="0" Trolley="600" Delivery="100" Available="-700" Pending="0" /> <TrolleyItems> <TrolleyItem Description="Test Item 1" value="http://stackoverflow.com/questions/11486891/150" /> <TrolleyItem Description="Test Item 2" value="http://stackoverflow.com/questions/11486891/150" /> <TrolleyItem Description="Test Item 3" value="http://stackoverflow.com/questions/11486891/300" /> </TrolleyItems> </Content></ContentBlock>\[/code\]I need to check if each of the trolly items value attributes are under 800 and then show the Final delivery attribute if at least one of the items are under 800. But only need to show the Delivery value once.My XSLT .xsl file code looks like this.\[code\]<xsl:for-each select="Content/TrolleyItems/TrolleyItem"> <xsl:if test="ContentBlock/Content/TrolleyItems/TrolleyItem/@value < 800"> <tr style="border-bottom: 1px dashed #000;"> <xsl:for-each select="Content/Final"> <td>Delivery Fee</td><td><xsl:value-of select="@Delivery"/></td> </xsl:for-each> </tr> </xsl:if> </xsl:for-each>\[/code\]What I need is to output one item for the @Delivery attribute.It will only show one time for example the answer will be: "Delivery Costs: 100". So Delivery is only charged when the item value is less than 800![enter image description here][1]Thanks for the help.
 
Back
Top