[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSL Trnasfromation - Is it possible to do a bottom up transformation?


Subject: Re: [xsl] XSL Trnasfromation - Is it possible to do a bottom up transformation?
From: "Raghu Narayan Koratagere" <raghu.k.n@xxxxxxxxx>
Date: Mon, 19 Nov 2007 16:41:15 +0530

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/


Current Thread