XForms xpath使用手册

本文所描述的所有函数为XForms 1.1所提供的xpath函数,这些函数只能在GForms的xpath编辑器中可用,这样才能在运行时识别并执行。

不可在XMLUtil、标准XML DOM中使用这些函数。

GForms平台提供xpath编辑器,该编辑器可以协助开发者完成大多数xpath表达式开发:



1、节点函数

1.1、instance函数

node-set instance(string?)

An XForms Model can contain more than one instance. This functionallows access to instance data, within the same XForms Model, but outside theinstance data containing the context node.

If the argument is omitted or is equal to the empty string, thenthe root element node (also called the document element node) is returned forthe default instance in the model that contains the current context node.

Otherwise, the argument is converted to a string as if by a callto the string function. This string is treated as an IDREF, which is matchedagainst instance elements in the containing document. If a match is located, andthe matching instance data is associated with the same XForms Model as thecurrent context node, this function returns a node-set containing just the rootelement node (also called the document element node) of the referenced instancedata. In all other cases, an empty node-set is returned.

Example:

For instance data corresponding to this XML:

<xforms:instancexmlns="" id="orderform">

  <orderForm>

    <shipTo>

      <firstName>John</firstName>

    </shipTo>

  </orderForm>

</xforms:instance>

The following expression selects the firstName node. Note that the instance function returns an elementnode, effectively replacing the leftmost location step from the path:

ref="instance('orderform')/shipTo/firstName"


2、字符串函数

2.1、if函数

string if(booleanstringstring)

Function if evaluates the first parameter as boolean, returning the secondparameter when true, otherwise the third parameter.

2.2、property函数

string property(string)

This function accepts a string identifying a property name. If theproperty name is not recognized, empty string is returned. The propertydefinitions for this function are as follows:

Property

Return Value

version

1.1

conformance-level

full, basic or a string beginning with full or basic

Any

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值