Re: How-to: Edit hierarchical structure with tree-view navigation

Posted by Alessandro Vernet on
URL: https://discuss.orbeon.com/How-to-Edit-hierarchical-structure-with-tree-view-navigation-tp3677789p3756542.html

Hi Gerrit,

Sorry the the delay; I just got back from vacation this week. I never
thought about using count(preceding::*)+count(ancestor::*), but if
your document structure doesn't change (no elements added or removed),
then I think it is a reliable way to identify an element. And this way
you can indeed build a tree that lets you explore any document.

Another possibility would be to use saxon:path(), which may work
better, to a certain extent, if the structure of the document changes.
If it isn't, I'd stick with count(preceding::*)+count(ancestor::*), as
it is simpler.

http://www.saxonica.com/documentation9.1/extensions/functions/path.html

Alex

On Tue, Jul 19, 2011 at 3:15 AM, Gerrit Boers <[hidden email]> wrote:

>
> Hi,
> I have another how-to, it's a universal tree-view based master-detail viewer/editor. Before I start writing I would like to check the basic assumption underlying this form:
> For any element in an xml document the count(preceding::*)+count(ancestor::*)  uniquely identifies that element.
> The tree-view is bound to a navigation instance:
> <xforms:select1 ref="instance('navigation')" appearance="xxforms:tree">
> The tree-view has the following itemset (all elements in the document):
> <xforms:itemset nodeset="instance('xml-instance')//*">
> Label and value are:
> <xforms:label ref="name()"/>
> <xforms:value ref="count(preceding::*)+count(ancestor::*)"/>
> The detail view works like this:
> <xforms:group ref="instance('xml-instance')//*[count(preceding::*)+count(ancestor::*)=instance('navigation')]">
>
> Here's a screen capture with the form showing itself:
>
> If my assumption is correct, this form can navigate and show/edit any xml document.
>
> Regards,
> Gerrit
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet