[xsl] How to multiply 2 sequences ?

Subject: [xsl] How to multiply 2 sequences ?
From: "TEICHERT, Peter" <Peter.TEICHERT@xxxxxxxxxx>
Date: Wed, 7 Nov 2007 11:18:50 +0100
Hello XSLT users,

I am developing an XML, XSLT 2.0 based food database.
I am trying to extract and process the XML data but until now with limited

The database has the following xml schema:

some of the single food ingredients ( extracted via attribute id )

  <xs:element name="NAME" type="xs:normalizedString">
    <xs:annotation xml:lang="de">
      <xs:documentation>Bezeichnung des Lebensmittels</xs:documentation>

  <xs:element name="GCAL" type="xs:nonNegativeInteger">
    <xs:annotation xml:lang="de">
      <xs:documentation>Energie, kcal/100g</xs:documentation>

all single food ingredients collected in food element "ing" having attribute

The following issues need to be solved :

1. extraction of single food ingredients

<xsl:template match="/">

  <xsl:variable name="input_bls" as="item()*">
    <xsl:sequence select="('B100000', 'B105100', 'B106311')"/>

  <xsl:variable name="input_amt" as="item()*">
    <xsl:sequence select="(100, 50, 10)"/>

  <xsl:apply-templates select="in:ingredient/in:ing[@in:id=$input_bls]"/>

this works

2. multiplication with weight factor variable $input_amt

<xsl:template match="in:ingredient/in:ing">
  <xsl:param name="input_amt">0</xsl:param>
  <xsl:variable name="GCAL" select="in:GCAL * $input_amt"/>

this works with the same weight factor for every food element,
but the weight factors are different for every food element

3. sum of single food ingredients per food element

this is also unclear because step 2 is still unclear.

Can You assist me with this ?

How can I multiply a node sequence with different factors ?

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
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