[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL Trnasfromation - Is it possible to do a bottom
Hi Raghu,
See my remarks below, Cheers, -- Abel Braaksma Raghu Narayan Koratagere wrote:
<xsl:template match="unitPrice[../itemTypeCode = '1']"> <xsl:copy><xsl:value-of select="../netPrice" /></xsl:copy> </xsl:template> 2. If the itemTypeCode of the current Item is '2' then unitPrice is <xsl:template match="unitPrice[../itemTypeCode = '2']"> <xsl:copy><xsl:value-of select="sum(../unitPrice div ../quantity)" /></xsl:copy> </xsl:template> 3. If the itemTypeCode of the current Item is '3' then unitPrice is <xsl:template match="unitPrice[../itemTypeCode = '3']"> <xsl:copy><xsl:value-of select="sum(../unitPrice[1] div ../quantity[1])" /></xsl:copy> </xsl:template> Unfortunately, it is quite unclear from your (not-well-formed!!) source sample code what you mean by "child element". Please provide a working set of source xml, and show us the XSLT that you currently have with the part that's troubling you. In lieu of this, please make clear what "recursive" means to you. Usually, a recursive template approach is rather trivial in XSLT, but obviously, it is rather non-trivial to invent what you might mean by "recursive" as it may have many meanings. If you need to calculate the sum of all unitPrice from a certain level, arbitrarily deep, then you should use the following statement, assuming your context node is on the right (parent) level: sum(.//unitPrice) HTH, Cheers, -- Abel Braaksma
|
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
|