如何查找的总和和最大值中存在的字段?

发布于 2025-01-01 00:16:00 字数 2966 浏览 1 评论 0原文

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:odt="http://orbeon.org/oxf/xml/datatypes"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:sql="http://orbeon.org/oxf/xml/sql"
    xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
    xmlns:p="http://www.orbeon.com/oxf/pipeline"
    xmlns:saxon="http://saxon.sf.net/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:oxf="http://www.orbeon.com/oxf/processors"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
    xmlns:exforms="http://www.exforms.org/exf/1-0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
    xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exf="http://www.exforms.org/exf/1-0"
    xmlns:date="http://exslt.org/dates-and-times">

    <xhtml:head>


        <xforms:model id="model">


        <xforms:instance id="test">
            <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                <add>
                    <yes></yes>
                </add>
            </form>
        </xforms:instance>  

        <xforms:instance id="duplicate-section">
                <form>
                <add>
                    <yes></yes>
                </add>
                </form>
        </xforms:instance>

                <xforms:bind id="yes" nodeset="instance('test')/add/yes" />

        </xforms:model>
    </xhtml:head>

    <xhtml:body>
        <table>
            <tr>
                <td>
                    <xforms:trigger incremental="true">
                        <xforms:label>Add</xforms:label> 
                        <xforms:insert ev:event="DOMActivate" context="instance('test')" origin="instance('duplicate-section')/add"/>
                    </xforms:trigger>
                </td>
            </tr>
            <xforms:repeat nodeset="instance('test')/add" id="add-repeat" startindex="1">
            <tr>
            <td><xforms:output ref="position()"/></td>
                <td>
                    <fr:currency ref="yes" incremental="true">
                    </fr:currency>
                </td>
            </tr>
        </xforms:repeat>            
        </table>
    </xhtml:body>
</xhtml:html>

考虑到这一点,我单击“添加”按钮 5 次,并在 5 个文本框中输入值。我想找到这 5 个输入值的总和,并且我想找到这 5 个值的最大值。我怎样才能做到这一点?我只想显示总和和最大值。

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:odt="http://orbeon.org/oxf/xml/datatypes"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:sql="http://orbeon.org/oxf/xml/sql"
    xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
    xmlns:p="http://www.orbeon.com/oxf/pipeline"
    xmlns:saxon="http://saxon.sf.net/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:oxf="http://www.orbeon.com/oxf/processors"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
    xmlns:exforms="http://www.exforms.org/exf/1-0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
    xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exf="http://www.exforms.org/exf/1-0"
    xmlns:date="http://exslt.org/dates-and-times">

    <xhtml:head>


        <xforms:model id="model">


        <xforms:instance id="test">
            <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                <add>
                    <yes></yes>
                </add>
            </form>
        </xforms:instance>  

        <xforms:instance id="duplicate-section">
                <form>
                <add>
                    <yes></yes>
                </add>
                </form>
        </xforms:instance>

                <xforms:bind id="yes" nodeset="instance('test')/add/yes" />

        </xforms:model>
    </xhtml:head>

    <xhtml:body>
        <table>
            <tr>
                <td>
                    <xforms:trigger incremental="true">
                        <xforms:label>Add</xforms:label> 
                        <xforms:insert ev:event="DOMActivate" context="instance('test')" origin="instance('duplicate-section')/add"/>
                    </xforms:trigger>
                </td>
            </tr>
            <xforms:repeat nodeset="instance('test')/add" id="add-repeat" startindex="1">
            <tr>
            <td><xforms:output ref="position()"/></td>
                <td>
                    <fr:currency ref="yes" incremental="true">
                    </fr:currency>
                </td>
            </tr>
        </xforms:repeat>            
        </table>
    </xhtml:body>
</xhtml:html>

Consider that, I click add button 5 times and enter values in the 5 text boxes. I want to find the sum of these 5 values entered and also I would like to find the maximum value of these 5 values. How can I achieve this ? I just want to display the sum and the maximum value.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

惟欲睡 2025-01-08 00:16:00

对于 Sum,您可以输出此 xpath 表达式:

<xforms:output value="sum(instance('test')/add/yes)" />

对于 Max,请使用:

<xforms:output value="max(instance('test')/add/yes)" />

For Sum you can output this xpath expression:

<xforms:output value="sum(instance('test')/add/yes)" />

For Max, use this:

<xforms:output value="max(instance('test')/add/yes)" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文