Orbeon - 显示来自 xpl 的动态数据中的 10 多个项目
Orbeon - Show more than 10 items in dynamic data from xpl
我修改了文件 countries.xpl 以从 xml 重定向和加载我公司的数据。
我需要在动态数据下拉列表中显示很多项目。
我修改了这一行的countries.xpl:
<xsl:copy-of select="/countries/country[starts-with(lower-case(name),lower-case($name))][10 >= position()]"/>
如果我将值“10”更新为减去 10 的数字,例如“8”,这将起作用,并且我在动态数据下拉列表中只看到 8 个项目。
但是如果我将此值“10”修改为高于 10 的数字,例如“11”,我在动态数据中只会看到 10 个项目,而不是 11 个或更多。
我的问题是:是否可以在动态数据下拉列表中显示超过 10 个项目?
是否正确修改了<xsl:copy-of select="/countries...
行号?还是我需要修改 xpl 中的其他行?
我附上了 xpl 的代码以继续:
<!--
Copyright (C) 2004 Orbeon, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License as published by the Free Software Foundation; either version
2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<p:param name="instance" type="input"/>
<p:param name="data" type="output"/>
<p:processor name="oxf:request">
<p:input name="config">
<config>
<include>/request/parameters/parameter[name = 'country-name']</include>
<include>/request/parameters/parameter[name = 'all']</include>
</config>
</p:input>
<p:output name="data" id="request"/>
</p:processor>
<p:processor name="oxf:xslt">
<p:input name="data" href="countries.xml"/>
<p:input name="request" href="#request"/>
<p:input name="instance" href="#instance"/>
<p:input name="config">
<countries xsl:version="2.0">
<xsl:variable
name="name"
select="if (doc('input:instance')/*/@xsi:nil = 'true') (: No instance was posted to this service :)
then doc('input:request')/request/parameters/parameter[name = 'country-name']/value (: Try getting request parameter :)
else doc('input:instance')/instance/country-name (: Use name in posted instance :)"/>
<xsl:variable
name="all"
select="doc('input:request')/request/parameters/parameter[name = 'all']/value = 'true'"/>
<xsl:choose>
<!-- If no name is specified, just take the first 10 countries unless all=true -->
<xsl:when test="empty($name)">
<xsl:copy-of select="/countries/country[$all or position() le 10]"/>
</xsl:when>
<!-- Get first 10 countries that start with provided name -->
<xsl:otherwise>
<xsl:copy-of select="/countries/country[starts-with(lower-case(name), lower-case($name))][11 >= position()]"/>
</xsl:otherwise>
</xsl:choose>
</countries>
</p:input>
<p:output name="data" ref="data"/>
</p:processor>
</p:config>
请帮助我。
非常感谢
此致
您可以在 <fr:autocomplete>
上添加 max-results-displayed
属性。有关 max-results-displayed
的示例和更多信息,请参阅自动完成文档的 Maximum number of displayed results 部分。
我修改了文件 countries.xpl 以从 xml 重定向和加载我公司的数据。
我需要在动态数据下拉列表中显示很多项目。
我修改了这一行的countries.xpl:
<xsl:copy-of select="/countries/country[starts-with(lower-case(name),lower-case($name))][10 >= position()]"/>
如果我将值“10”更新为减去 10 的数字,例如“8”,这将起作用,并且我在动态数据下拉列表中只看到 8 个项目。
但是如果我将此值“10”修改为高于 10 的数字,例如“11”,我在动态数据中只会看到 10 个项目,而不是 11 个或更多。
我的问题是:是否可以在动态数据下拉列表中显示超过 10 个项目?
是否正确修改了<xsl:copy-of select="/countries...
行号?还是我需要修改 xpl 中的其他行?
我附上了 xpl 的代码以继续:
<!--
Copyright (C) 2004 Orbeon, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License as published by the Free Software Foundation; either version
2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<p:param name="instance" type="input"/>
<p:param name="data" type="output"/>
<p:processor name="oxf:request">
<p:input name="config">
<config>
<include>/request/parameters/parameter[name = 'country-name']</include>
<include>/request/parameters/parameter[name = 'all']</include>
</config>
</p:input>
<p:output name="data" id="request"/>
</p:processor>
<p:processor name="oxf:xslt">
<p:input name="data" href="countries.xml"/>
<p:input name="request" href="#request"/>
<p:input name="instance" href="#instance"/>
<p:input name="config">
<countries xsl:version="2.0">
<xsl:variable
name="name"
select="if (doc('input:instance')/*/@xsi:nil = 'true') (: No instance was posted to this service :)
then doc('input:request')/request/parameters/parameter[name = 'country-name']/value (: Try getting request parameter :)
else doc('input:instance')/instance/country-name (: Use name in posted instance :)"/>
<xsl:variable
name="all"
select="doc('input:request')/request/parameters/parameter[name = 'all']/value = 'true'"/>
<xsl:choose>
<!-- If no name is specified, just take the first 10 countries unless all=true -->
<xsl:when test="empty($name)">
<xsl:copy-of select="/countries/country[$all or position() le 10]"/>
</xsl:when>
<!-- Get first 10 countries that start with provided name -->
<xsl:otherwise>
<xsl:copy-of select="/countries/country[starts-with(lower-case(name), lower-case($name))][11 >= position()]"/>
</xsl:otherwise>
</xsl:choose>
</countries>
</p:input>
<p:output name="data" ref="data"/>
</p:processor>
</p:config>
请帮助我。 非常感谢 此致
您可以在 <fr:autocomplete>
上添加 max-results-displayed
属性。有关 max-results-displayed
的示例和更多信息,请参阅自动完成文档的 Maximum number of displayed results 部分。