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

so how does sum() work?

Subject: so how does sum() work?
From: "Jacek Radajewski" <jacekrad@xxxxxxxxx>
Date: Wed, 14 May 2008 16:20:29 +1000
 so how does sum() work?
Hi All,

I'm experiencing a strange (for me) behavior in my XSLT:

This works:
        <xsl:for-each select="cdm:classification/cdm:app-domain">
          <xsl:call-template name="print-assertion">
            <xsl:with-param name="business-rule">APP-0010</xsl:with-param>
            <xsl:with-param name="message">A classification to a
Functional Application Domain must include a percentage of use greater
              zero. </xsl:with-param>
            <xsl:with-param name="result"
select="number(@cdm:percent-of-use) &gt; 0"/>

But this produces "required item type of first operand of '/' is node;
supplied value has item type xs:string"
        <xsl:call-template name="print-assertion">
          <xsl:with-param name="business-rule">APP-0011</xsl:with-param>
          <xsl:with-param name="message">An Application's percentage
of use across all non LOB domain classifications must be equal to
100%. </xsl:with-param>
          <xsl:with-param name="result"
select="sum(cdm:classification/cdm:app-domain/@cdm:percent-of-use) =

I'm using saxon 9B inside oxygen 9.2

Now if I execute
sum(cdm:classification/cdm:app-domain/@cdm:percent-of-use) = 1.0
within oxygen it correctly evaluates to either true or false, but
produces error when executing within my XSLT ... but only if the
result evaluates to false.  When the sum of those attributes does
equal 1.0 then no error is generated.

Any ideas?

Thanks in advance

Oh, BTW: I call my print-assertion template maybe 40 times in my
stylesheet and all works well.  Its only the sum() that is causing me


----------- print-assetrion template --------------------
 <xsl:template name="print-assertion">
    <xsl:param name="result" select="false()"/>
    <xsl:param name="element"/>
    <xsl:param name="business-rule"/>
    <xsl:param name="message"/>
    <xsl:if test="not($result) or $print-passed-assertions">
          <xsl:value-of select="$business-rule"/>
          <xsl:value-of select="$result"/>
          <xsl:copy-of select="$element"/>
          <xsl:copy-of select="$message"/>

Jacek Radajewski

Current Thread


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.
First Name
Last Name
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-2013 All Rights Reserved.