Re: showing relationships in xforms

Ah, thanks a lot! I never actually tried the example myself - the code I
was struggling with was too complicated to explain (bad sign?) so I just
made something up. I was misled by what is obviously old or incomplete
documentation into thinking current() wasn't available, which set me off in
the wrong direction. I've fixed the real problem now and will stick to the
spec as documentation (unless you've got any recommendations to make?).
Once again, thanks a lot.

Kevin Flynn

On Mon, Apr 16, 2012 at 7:44 PM, Erik Bruchez <ebruchez@gmail.com> wrote:

> Kevin,
>
> `current()` is an XForms function, and is supported in Orbeon Forms.
> It "Returns the context node used to initialize the evaluation of the
> containing XPath expression." [1]
>
> In light of this, since you don't say in which XPath context your
> expression is running, it's not possible to say what your expression
> should return in all cases. But this example works:
>
> https://gist.github.com/2400248
>
> -Erik
>
> [1] http://www.w3.org/TR/xforms11/#fn-current
>
> On Mon, Apr 16, 2012 at 4:48 AM, Kevin Flynn <kemifl@gmail.com> wrote:
> > Hi,
> >
> > I'm currently experimenting with xforms and having difficulty displaying
> > information about relationships. Given a data instance like this:
> >
> > <persons>
> >  <person>
> >   <id>marx</id>
> >   <name>Karl Marx</name>
> >  </person>
> >  <person>
> >   <id>engels</id>
> >   <name>Friedrich Engels</name>
> >   <friend>marx</friend>
> >  </person>
> > </persons>
> >
> > I would expect to be able to display "Karl Marx" from the context
> > /persons/person[id='engels'] by doing something like:
> >
> > <xforms:output
> ref="instance('persons')/person[id=current()/friend]/name"/>
> >
> > ....but, needless to say, I can't.
> >
> > I realize that the current() function I'm used to from XSLT is not
> available
> > in XForms (I use it above for illustration), but I presume that there
> must
> > be something functionally equivalent... Can anybody enlighten me?
> >
> > I'm using Orbeon forms, if that is significant.
> >
> > Hope somebody can help
> >
> > Kevin Flynn
>

Received on Wednesday, 18 April 2012 05:36:11 UTC