Subject: [xsl] Re2 : How to multiply 2 sequences ? From: "TEICHERT, Peter" <Peter.TEICHERT@xxxxxxxxxx> Date: Thu, 8 Nov 2007 16:53:48 +0100 |
Hi, I found a following working solution: <xsl:template match="in:ingredient"> <!-- this is the Food item id --> <xsl:variable name="input_bls" as="item()*"> <xsl:sequence select="('B100000', 'B105100', 'B106311')"/> </xsl:variable> <!-- this is the weight factor --> <xsl:variable name="input_amt" as="item()*"> <xsl:sequence select="(100, 50, 10)"/> </xsl:variable> <!-- this is one of the food ingredients of one food item --> <xsl:variable name="GCAL" as="xs:decimal">0</xsl:variable> <xsl:variable name="GCAL_sum" as="xs:decimal">0</xsl:variable> <xsl:for-each select="in:ing[@in:id=$input_bls]"> <xsl:variable name="i" as="xs:integer"> <xsl:value-of select="position()"/> </xsl:variable> <xsl:variable name="GCAL" select="in:GCAL*$input_amt[$i]" /> <xsl:variable name="GCAL_sum" select="$GCAL_sum + $GCAL" /> <xsl:value-of select="$GCAL_sum"/><br/> </xsl:for-each> </xsl:template> The only issue is now how to sum up the $GCAL to have $GCAL_sum Best regards Peter Teichert This e-mail is intended only for the above addressee. It may contain privileged information. If you are not the addressee you must not copy, distribute, disclose or use any of the information in it. If you have received it in error please delete it and immediately notify the sender. Security Notice: all e-mail, sent to or from this address, may be accessed by someone other than the recipient, for system management and security reasons. This access is controlled under Regulation of security reasons. This access is controlled under Regulation of Investigatory Powers Act 2000, Lawful Business Practises.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Re: How to multiply 2 seq, Michael Kay | Thread | [xsl] extending xsl with javascript, april |
RE: [xsl] Re: How to multiply 2 seq, Michael Kay | Date | Re: [xsl] Accessing context from xs, Wendell Piez |
Month |