Question

I am using orbeon and I am trying to read child element defined in XBL. Here is how my xform definition looks like

<fr:foobar ref="mynode" constraint="unique">
  <fr:foo from="abc" to="def">
    <fr:bar key="id" name="primary" />
  </fr:foo>
</fr:foobar>

In XBL I can't seem to find an easy way to read the child element. I am obviously missing something simple.

<xforms:group xxbl:scope="inner">
    <!-- works -->
    <xxforms:variable name="foocontext">
        <xxforms:sequence select="{fr:foo/@from}" xxbl:scope="outer" />
    </xxforms:variable>

    <!-- does not works -->    
    <xxforms:variable name="barcontext" as="node()?">
        <xxforms:sequence select="{fr:foo/fr:bar}" xxbl:scope="outer" />
    </xxforms:variable>
</xforms:group>
Was it helpful?

Solution

An AVT always return text. So {fr:foo/fr:bar} is equivalent to {string(fr:foo/fr:bar)}, which in this case won't do what you expect. This is a tricky one, and I see two solutions:

  1. Don't define that XForms variable. Instead iterate over the structure in XSLT, and generate whatever XForms you want to generate. This is "most likely" the best way out (but don't believe what I say, since I don't even know what you are trying to do!).
  2. If you really need that variable, you'll need to copy those <fr:bar> elements into an instance with XSLT (<xsl:copy-of>), and then point to the nodes in that instance with the <xxforms:variable>.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top