Re: XSL Trnasfromation - Is it possible to do a bottom
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/
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