Hi, I’m using IBM Workplace Forms Designer tool to create eForms;
whose output is an XML syntax called XFDL (eXtensible Forms Description
Language), which support the XForms standard. (Ie, certain controls are written
in xforms.) I’m running a stylesheet against it to transform the xfdl to
xhtml + xforms. I got support from this group to resolve many of the issues
related to it. Thanks for all the support. There are some more issues to be resolved and I request your
help in resolving that. One difficulty I faced during the transformation of XFDL to
XHTML using XSLT is that in XFDL, we can set the datatype for an input field,
its min length, max length, range etc using a non-xform tag (<format>).
Please see the code snippet below. But in xforms, we add this in xforms:model
using xforms:bind. So, using XSLT, we need to convert all these constraints in the
<format> tag in XFDL to the corresponding xforms:bind attributes in
XForms. <pane
sid="PANE1">
<xforms:group ref="instance('INSTANCE')/PAGE1/details">
<xforms:label></xforms:label>
<field sid="fldAge">
<xforms:input ref="age">
<xforms:label></xforms:label>
</xforms:input>
<itemlocation>
<x>13</x>
<y>37</y>
<width>101</width>
</itemlocation>
<format>
<datatype>integer</datatype> àthis corresponds to type=xs:integer in xforms:bind
<constraints>
<mandatory>on</mandatory> àthis
corresponds to required=true() in xforms:bind
<range>
<min>0</min>
<max>50</max> àthis means that the
value should not exceed 50
</range>
</constraints>
</format>
</field>
</xforms:group>
<itemlocation>
<x>413</x>
<y>144</y>
<width>165</width>
<height>97</height>
</itemlocation>
</pane> The ‘ref’ attribute of the input field should
refer to the ‘ref’ attribute of the xforms:bind. Since its inside a
group(xforms:group), the ref attribute that should be bind should contain the
full path. The input control can be inside nested groups or repeats. In some
cases, the ref attribute of input field can also contain values as “../age”.
So we need a generic mechanism where the complete instance path is obtained
which can be used in xforms:bind. I request your help in solving this. Thanks Jency -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Hi, I’m using IBM Workplace Forms Designer tool to create eForms;
which is written in an XML syntax called XFDL (eXtensible Forms Description
Language), which supports the XForms standard. (ie, certain controls are
written in xforms.) I’m running a stylesheet against it to convert the
xfdl to xforms+ xhtml. I got support from Orbeon group to some extent in
implementing this. Thanks for all the support. Still I’m facing some
issues in the xsl transformation of xfdl. I request your help in resolving
these issues. One difficulty I face during the transformation of XFDL to
XHTML using XSLT is that in XFDL, we can set the datatype for an input field,
its min length, max length, range etc using a non-xform tag (<format>).
Please see the code snippet below. But in xforms, we add this in xforms:model
using xforms:bind. So, using XSLT, we need to convert all these constraints in
the <format> tag in XFDL to the corresponding xforms:bind attributes in
XForms. <pane
sid="PANE1"> <xforms:group
ref="instance('INSTANCE')/PAGE1/details">
<xforms:label></xforms:label> <field
sid="FIELD1"> <xforms:input
ref="age"> <xforms:label></xforms:label>
</xforms:input>
<itemlocation>
<x>32</x>
<y>33</y>
<width>114</width>
</itemlocation> <format>
<datatype>integer</datatype> à
this corresponds to the type=”xs:integer” in xforms:bind
<constraints>
<mandatory>on</mandatory> à this is equivalent to
required=true() in xforms bind
<range>
<min>0</min>
<max>50</max> à this means that the value
should not exceed 50
</range>
<length>
<min>0</min>
<max>2</max> à this means that the max
length allowed is 2
</length>
</constraints> </format> </field> </xforms:group> <itemlocation>
<x>421</x>
<y>164</y>
<width>108</width>
<height>77</height> </itemlocation> </pane> The ‘ref’ attribute of the input
control(xforms:input)in the above code should refer to the ‘ref’
attribute of the xforms:bind. But since the input control is inside
xforms:group, we need to get the full instance path to refer in xforms:bind. The
input control can be in nested groups or repeats. The ref attribute can also
contain values such as “../age”. So, we need a generic mechanism by
which we retrieve the complete instance to refer in xforms:bind. Hope you could help me in resolving this. Expecting your support, Thanks in advance Jency -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Hi Jency,
On 6/18/07, Jency Chackummoottil <[hidden email]> wrote: > The 'ref' attribute of the input control(xforms:input)in the above code > should refer to the 'ref' attribute of the xforms:bind. But since the input > control is inside xforms:group, we need to get the full instance path to > refer in xforms:bind. The input control can be in nested groups or repeats. > The ref attribute can also contain values such as "../age". So, we need a > generic mechanism by which we retrieve the complete instance to refer in > xforms:bind. As you iterate over the controls that have a <format> to generate the <xforms:bind>, you could generate the full XPath "ref" to the current control with: string-join(ancestor-or-self::*/@ref, '/') If the first ref at the top of the hierarchy does not start with "/", you might need to add a "/" at the beginning of that expression. This won't work for all the possible "ref" expressions, but it should work for things like ../age. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Hi Alex,
Thanks for your reply. Suppose if the situation is as follows: The code contains an xforms:group which refers to instance('user')/details and inside the group, there is an xforms:input whose ref attribute is 'age'. Will the below code generate the full XPath for ref of the input control? Thanks in advance Jency -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Alessandro Vernet Sent: Friday, June 22, 2007 12:44 AM To: [hidden email] Subject: Re: [ops-users] xfdl to xforms Hi Jency, On 6/18/07, Jency Chackummoottil <[hidden email]> wrote: > The 'ref' attribute of the input control(xforms:input)in the above > code should refer to the 'ref' attribute of the xforms:bind. But since > the input control is inside xforms:group, we need to get the full > instance path to refer in xforms:bind. The input control can be in nested groups or repeats. > The ref attribute can also contain values such as "../age". So, we > need a generic mechanism by which we retrieve the complete instance to > refer in xforms:bind. As you iterate over the controls that have a <format> to generate the <xforms:bind>, you could generate the full XPath "ref" to the current control with: string-join(ancestor-or-self::*/@ref, '/') If the first ref at the top of the hierarchy does not start with "/", you might need to add a "/" at the beginning of that expression. This won't work for all the possible "ref" expressions, but it should work for things like ../age. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
On 6/21/07, Jency Chackummoottil <[hidden email]> wrote:
> Thanks for your reply. Suppose if the situation is as follows: > The code contains an xforms:group which refers to > instance('user')/details and inside the group, there is an xforms:input > whose ref attribute is 'age'. Will the below code generate the full > XPath for ref of the input control? Yes, I think it should work in this case. But of course, only trying this in your stylesheet will tell for sure :). Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Alessandro Vernet
Hi Alex,
This is with regard to the below mail that you send me last month. I have 2 cases. Case 1: the xml is of the following form: <pane sid="PANE1"> <xforms:group ref="instance('INSTANCE')/PAGE1/details"> <xforms:label></xforms:label> <field sid="FIELD1"> <xforms:input ref="age"> <xforms:label></xforms:label> </xforms:input> <format> <datatype>integer</datatype> </format> </field> </xforms:group> </pane> The xforms:group has ref attribute as instance('INSTANCE')/PAGE1/details and xforms:input inside the xforms:group has ref as age. In this case your solution to generate the full XPath for "ref" - string-join(ancestor-or-self::*/@ref, '/') works. Here's my code to generate the full instance: <xsl:template match="xfdl:format"> <xsl:variable name="ref-attr" select="string-join(ancestor-or-self::*/@ref, '/')"/> <format-ref> <xsl:if test="normalize-space($ref-attr)!=''"> <xsl:value-of select="concat($ref-attr,'/',../xforms:*/@ref)"/> </xsl:if> <xsl:if test="normalize-space($ref-attr)=''"> <xsl:value-of select="../xforms:*/@ref"/> </xsl:if> </format-ref> <xsl:apply-templates/> </xsl:template> The output is <format-ref> instance('INSTANCE')/PAGE1/details/age </format-ref> Case 2: xml is of the following format <pane sid="PANE1"> <xforms:group ref="instance('INSTANCE')/PAGE1/details"> <xforms:label></xforms:label> <field sid="FIELD1"> <xforms:input ref=" instance('INSTANCE')/PAGE1/details/age"> <xforms:label></xforms:label> </xforms:input> <format> <datatype>integer</datatype> </format> </field> </xforms:group> </pane> Case 3: <pane sid="PANE1"> <xforms:group ref="instance('INSTANCE')/PAGE1/details"> <xforms:label></xforms:label> <pane sid="PANE2"> <xforms:group ref="instance('INSTANCE')/PAGE1/details/subfields"> <xforms:label></xforms:label> <field sid="age"> <xforms:input ref="age"> <xforms:label></xforms:label> </xforms:input> <format> <datatype>integer</datatype> </format> </field> </xforms:group> </pane> </xforms:group> </pane> In case2 and case3, string-join(ancestor-or-self::*/@ref, '/') will give the wrong result. The output of case2 and case 3 are Case 2 output: <format-ref> instance('INSTANCE')/PAGE1/details/instance('INSTANCE')/PAGE1/details/ag e </format-ref> Case 3 output: <format-ref> instance('INSTANCE')/PAGE1/details/instance('INSTANCE')/PAGE1/details/su bfields/age </format-ref> So, in case of controls inside nested groups, we need to join the ref attributes only until we reach something like instance('<instanceid>') Please help me in doing this Thanks in advance Jency On 6/18/07, Jency Chackummoottil <[hidden email]> wrote: > The 'ref' attribute of the input control(xforms:input)in the above > code should refer to the 'ref' attribute of the xforms:bind. But since > the input control is inside xforms:group, we need to get the full > instance path to refer in xforms:bind. The input control can be in nested groups or repeats. > The ref attribute can also contain values such as "../age". So, we > need a generic mechanism by which we retrieve the complete instance to > refer in xforms:bind. As you iterate over the controls that have a <format> to generate the <xforms:bind>, you could generate the full XPath "ref" to the current control with: string-join(ancestor-or-self::*/@ref, '/') If the first ref at the top of the hierarchy does not start with "/", you might need to add a "/" at the beginning of that expression. This won't work for all the possible "ref" expressions, but it should work for things like ../age. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Hi Jency,
On 7/19/07, Jency Chackummoottil <[hidden email]> wrote: > Case 2 output: > > instance('INSTANCE')/PAGE1/details/instance('INSTANCE')/PAGE1/details/ag I understand that this is not what you would expect. In fact, I haven't thought about this case where I wrote the XPath expression that builds this. But: this should work! :) In XPath 2.0, if you write /a/b/f(), then f() will be evaluate in the context of /a/b. In your case the f() is instance(), and instance() does not care about the context. So as long as there is a /a/b, writing /a/b/instance('foo') is equivalent to just instance('foo'). You can see this in the code below which you can run in the XForms sandbox: <xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:widget="http://orbeon.org/oxf/xml/widget" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xhtml:head> <xforms:model> <xforms:instance id="instance1"> <instance> <a>1</a> </instance> </xforms:instance> <xforms:instance id="instance2"> <instance> <b>2</b> </instance> </xforms:instance> </xforms:model> </xhtml:head> <xhtml:body> <xforms:output value="instance('instance1')/a"/> <xforms:output value="instance('instance1')/a/instance('instance2')/b"/> </xhtml:body> </xhtml:html> The first xforms:output will show "1" (from instance1), and the second xforms:output will show "2" (from instance2). For the second xforms:output, the XPath expression is instance('instance1')/a/instance('instance2')/b, which in this case is equivalent to just instance('instance2')/b. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |