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 |
Administrator
|
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 |
Hi Alex,
I did some more testing and it turns out that both count() operations are 'expensive', it works for documents up to about 1000 lines and gets progressively slower above that. Having said that, it's a nice solution for smaller documents like xforms. I'm still thinking what to put in the 'how-to', as soon as I have figured this out I will put it on the Wiki. Using xxforms:evaluate(), the tree view can also be dynamically configured. This: <xforms:itemset nodeset="xxforms:evaluate(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/navigationNodeset)"> <xforms:label ref="xxforms:evaluate(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/itemsetLabel)"/> <xforms:value ref="count(preceding::*)+count(ancestor::*)"/> </xforms:itemset> in combination with a configuration instance like this: <xforms:instance id="detail-configuration-instance"> <configurations> <configuration> <name>XForm NO xhtml</name> <root/> <navigationNodeset>instance('xml-instance')//*[not(local-name()=tokenize(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/filter,'\s'))]</navigationNodeset> <itemsetLabel>local-name()</itemsetLabel> <itemsetValue/> <filter>head body table tr td div</filter> </configuration> .... Makes it possible to select the nodes to be displayed in the tree, filter nodes and more. Because count(preceding::*) and count(ancestor::*) are independent of the itemset context, navigation still works when nodes are filtered, regards, Gerrit On Aug 20, 2011, at 4:49 AM, Alessandro Vernet wrote:
-- 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 |
Administrator
|
Hi Gerrit,
Are you saying that you are still using the count() technique, but that by filtering which nodes it is applied on, you are now getting a more reasonable performance with larger documents? Alex On Tuesday, August 23, 2011, Gerrit Boers <[hidden email]> wrote: > Hi Alex, > I did some more testing and it turns out that both count() operations are 'expensive', it works for documents up to about 1000 lines and gets progressively slower above that. Having said that, it's a nice solution for smaller documents like xforms. I'm still thinking what to put in the 'how-to', as soon as I have figured this out I will put it on the Wiki. > Using xxforms:evaluate(), the tree view can also be dynamically configured. > This: > <xforms:itemset nodeset="xxforms:evaluate(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/navigationNodeset)"> > <xforms:label ref="xxforms:evaluate(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/itemsetLabel)"/> > <xforms:value ref="count(preceding::*)+count(ancestor::*)"/> > </xforms:itemset> > in combination with a configuration instance like this: > <xforms:instance id="detail-configuration-instance"> > <configurations> > <configuration> > <name>XForm NO xhtml</name> > <root/> > <navigationNodeset>instance('xml-instance')//*[not(local-name()=tokenize(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/filter,'\s'))]</navigationNodeset> > <itemsetLabel>local-name()</itemsetLabel> > <itemsetValue/> > <filter>head body table tr td div</filter> > </configuration> > .... > Makes it possible to select the nodes to be displayed in the tree, filter nodes and more. Because count(preceding::*) and count(ancestor::*) are independent of the itemset context, navigation still works when nodes are filtered, > > regards, > Gerrit > > On Aug 20, 2011, at 4:49 AM, Alessandro Vernet wrote: > > 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 > > -- 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 |
Hi Alex,
No, with big documents it still is to slow to be usefull. It's just a method to filter out stuff you don't want to see. For instance, filter all xhtml elements from a form so you can concentrate on the xform elements. regards, Gerrit On Aug 24, 2011, at 8:01 AM, Alessandro Vernet wrote: Hi 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 |
Administrator
|
Hi Gerrit,
I understand; thank you for sharing this. Alex On Thu, Aug 25, 2011 at 1:09 AM, Gerrit Boers <[hidden email]> wrote: > Hi Alex, > No, with big documents it still is to slow to be usefull. It's just a method > to filter out stuff you don't want to see. For instance, filter all xhtml > elements from a form so you can concentrate on the xform elements. > regards, > Gerrit > > On Aug 24, 2011, at 8:01 AM, Alessandro Vernet wrote: > > Hi Gerrit, > > Are you saying that you are still using the count() technique, but that by > filtering which nodes it is applied on, you are now getting a more > reasonable performance with larger documents? > > Alex > > On Tuesday, August 23, 2011, Gerrit Boers <[hidden email]> wrote: >> Hi Alex, >> I did some more testing and it turns out that both count() operations are >> 'expensive', it works for documents up to about 1000 lines and gets >> progressively slower above that. Having said that, it's a nice solution for >> smaller documents like xforms. I'm still thinking what to put in the >> 'how-to', as soon as I have figured this out I will put it on the Wiki. >> Using xxforms:evaluate(), the tree view can also be dynamically >> configured. >> This: >> <xforms:itemset >> nodeset="xxforms:evaluate(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/navigationNodeset)"> >> <xforms:label >> ref="xxforms:evaluate(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/itemsetLabel)"/> >> <xforms:value >> ref="count(preceding::*)+count(ancestor::*)"/> >> </xforms:itemset> >> in combination with a configuration instance like this: >> <xforms:instance id="detail-configuration-instance"> >> <configurations> >> <configuration> >> <name>XForm NO xhtml</name> >> <root/> >> >> <navigationNodeset>instance('xml-instance')//*[not(local-name()=tokenize(instance('detail-configuration-instance')/configuration[number(instance('selected-configuration'))]/filter,'\s'))]</navigationNodeset> >> <itemsetLabel>local-name()</itemsetLabel> >> <itemsetValue/> >> <filter>head body table tr td div</filter> >> </configuration> >> .... >> Makes it possible to select the nodes to be displayed in the tree, filter >> nodes and more. Because count(preceding::*) and count(ancestor::*) are >> independent of the itemset context, navigation still works when nodes are >> filtered, >> >> regards, >> Gerrit >> >> On Aug 20, 2011, at 4:49 AM, Alessandro Vernet wrote: >> >> 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 >> >> > > -- > 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 > > > > -- > 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 |
Free forum by Nabble | Edit this page |