[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re2 : How to multiply 2 sequences ?

Subject: Re2 : How to multiply 2 sequences ?
From: "TEICHERT, Peter" <Peter.TEICHERT@xxxxxxxxxx>
Date: Thu, 8 Nov 2007 16:53:48 +0100
 Re2 : How to multiply 2 sequences ?
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.