Michael,
Thanks for your response. Yes, recursive function is the answer to my
problem here. I was not aware of this construct as I am new to XSL. I
guess I shd be able to progress in this direction.
Difference between case 2 and 3 is as below:
Case 2 - get sum of unitprice all the children items divided by quanity
Case 3 - get sum of unitprice of only the first level children items
<xsl:function name="f:unitPrice" as="xs:decimal">
<xsl:param name="item" as="element(orderline)">
<xsl:choose>
<xsl:when test="$item/itemTypeCode = 1">
<xsl:sequence select="$item/netPrice"/>
</xsl:when>
<xsl:when test="$item/itemTypeCode = 2">
<xsl:sequence select="sum(for $c in $item/child::orderline
return f:unitPrice($c) * $c/quantity)"/>
</xsl:when>
<xsl:when test="$item/itemTypeCode = 3">
<xsl:sequence select="??"/>
<!-- I don't understand the difference between this and the previous
case -->
</xsl:when>
</xsl:choose>
</xsl:function>
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--