[DFDL-WG] clarification on dfdl:occursIndex() function

Steve Hanson smh at uk.ibm.com
Thu Jul 31 06:04:01 EDT 2014


Note:  The reason why fn:position() takes no argument is because it gives 
position in the current sequence. Which is also why we have a separate 
DFDL specific function dfdl:occursIndex() which is intended for giving 
position in enclosing array. I think we need an argument that targets the 
specific enclosing array.

Regards
 
Steve Hanson
Architect, IBM DFDL
Co-Chair, OGF DFDL Working Group
IBM SWG, Hursley, UK
smh at uk.ibm.com
tel:+44-1962-815848



From:   Tim Kimber/UK/IBM at IBMGB
To:     dfdl-wg at ogf.org, 
Date:   28/07/2014 23:51
Subject:        Re: [DFDL-WG] clarification on dfdl:occursIndex() function
Sent by:        dfdl-wg-bounces at ogf.org



I agree that it is inconvenient for the 'nearest array parent' to be 
inaccessible. However, experience with discriminators makes me fearful of 
any rule that includes the phrase 'nearest enclosing' :-) 
I think at least one other DFDL function allows the target of the function 
to be specified as an argument, but insists that the argument must be in 
the dynamic scope of the element ( i.e. its parent/grandparent etc ). I 
would be much happier with that solution for occursCountIndex(). 

I can think of a use case where it may be useful to get a consistent 
behaviour for occursCountIndex(). If a DFDL schema is generated from some 
other data format description then the model generation code may want to 
refer to the nth occurrence of something else in the model, where n is the 
occurs index of the current element - regardless of whether this 
particular element is an array. 

regards,

Tim Kimber, 




From:        Mike Beckerle <mbeckerle.dfdl at gmail.com> 
To:        "dfdl-wg at ogf.org" <dfdl-wg at ogf.org> 
Date:        28/07/2014 23:27 
Subject:        [DFDL-WG] clarification on dfdl:occursIndex() function 
Sent by:        dfdl-wg-bounces at ogf.org 



This function says it can be called on non-array elements. However, it 
does not say what the result is.

If called when "." is not itself an array element there are only two 
possible behaviors consistent with the fact that it is explicitly allowed 
on non-array elements. 

The result has to be either 

(a) 1 
(b) the occursIndex of the nearest enclosing array parent, or 1 if there 
is no enclosing array parent. 

I claim (a) is fairly pointless. You will just end up having to create 
newVariableInstances to carry the array current index downward into 
expressions. 

I cannot think of a use case where one would want to call occursIndex() 
polymorphically, i.e., where you want a number in the case of an array, 
but 1 otherwise. 

So (b) is the preferable behavior.


Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | 
www.tresys.com 
Please note: Contributions to the DFDL Workgroup's email discussions are 
subject to the OGF Intellectual Property Policy 
--
 dfdl-wg mailing list
 dfdl-wg at ogf.org
 https://www.ogf.org/mailman/listinfo/dfdl-wg 

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
--
  dfdl-wg mailing list
  dfdl-wg at ogf.org
  https://www.ogf.org/mailman/listinfo/dfdl-wg

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20140731/50299e82/attachment-0001.html>


More information about the dfdl-wg mailing list