xslt & xforms

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

xslt & xforms

Tanya Gray (Oxford)
Hello

a quick question. I would like to auto-generate an xforms input form from a dynamically-generated XML instance, using XSLT. The problem I've encountered is one of how to bind an xforms:input field to the relevant element in the XML instance.

With a static XSLT file, you would use something like <xforms:input ref="ns:element_name"/> to bind an input field to the element in the XML instance. Using a dynamically generated XSLT file, is it possible to populate the ref property in an <xsl:for-each> statement, as shown below?

<xsl:template match="/">
<xsl:for-each select="//*">
<xforms:input ref="ns:xml_element_name">
</xsl:for-each>
</xsl:template>

Also, just to say, I needed to use this approach as I found that when using a static XSLT file to transform an XML instance to an XFORMS input form, if there were XFORMS input fields in the XSLT file that referenced non-existence XML instance elements, this caused an error in the input form. This presents a problem when you have auto-generated XML instances and want to display an input form based on those instances using just one XSLT file. If anyone has had similar experiences I would be interested to discuss.

regards
Tanya







 








has anyone transformed an xml instance file to an xforms input form, using xslt.









--
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
Reply | Threaded
Open this post in threaded view
|

RE: xslt & xforms

Stephen Bayliss
I'd suggest instead you take a look at xforms:repeat.

I have an example where I've got an instance doc in this format
(actually this gets into the page using <xsl:copy-of
select="doc('input:instance')"/>:
<instance>
        <queryDef>
                <properties>
                        <property id="Title" displayName="Title">
                                <value></value>
                        </property>
                        <property id="Author" displayName="Author">
                                <value></value>
                        </property>
                        (etc)
                </properties>
        <queryDef>
<instance>

Then to generate my input controls, I use something along the lines of:

<!-- group based on the main instance -->
<xforms:group ref="instance('instance')">
        <xhtml:table>
                <!-- repeat on each property node -->
                <xforms:repeat nodesset="queryDef/properties/property">
                        <xhtml:tr>
                                <xhtml:td>
                                        <!-- first cell in row is the
displayName attribute of the property node -->
                                        <xforms:output
ref="@displayName"/>
                                </xhtml:td>
                                <xhtml:td>
                                        <!-- input control references
the value node beneath the property node -->
                                        <xforms:input ref="value"/>
                                </xhtml:td>
                        </xhtml:tr>
                </xforms:repeat>
        </xhtml:table>
</xforms:group>

This is a somewhat trimmed-down version of the sort of thing that might
suit what you're doing.  It should give you some idea anyway.

-----Original Message-----
From: Tanya Gray [mailto:[hidden email]]
Sent: 01 December 2005 15:41
To: [hidden email]; [hidden email]
Subject: [ops-users] xslt & xforms

Hello

a quick question. I would like to auto-generate an xforms input form
from a dynamically-generated XML instance, using XSLT. The problem I've
encountered is one of how to bind an xforms:input field to the relevant
element in the XML instance.

With a static XSLT file, you would use something like <xforms:input
ref="ns:element_name"/> to bind an input field to the element in the XML
instance. Using a dynamically generated XSLT file, is it possible to
populate the ref property in an <xsl:for-each> statement, as shown
below?

<xsl:template match="/">
<xsl:for-each select="//*">
<xforms:input ref="ns:xml_element_name">
</xsl:for-each>
</xsl:template>

Also, just to say, I needed to use this approach as I found that when
using a static XSLT file to transform an XML instance to an XFORMS input
form, if there were XFORMS input fields in the XSLT file that referenced
non-existence XML instance elements, this caused an error in the input
form. This presents a problem when you have auto-generated XML instances
and want to display an input form based on those instances using just
one XSLT file. If anyone has had similar experiences I would be
interested to discuss.

regards
Tanya







 








has anyone transformed an xml instance file to an xforms input form,
using xslt.











--
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
Reply | Threaded
Open this post in threaded view
|

RE: xslt & xforms

Tanya Gray (Oxford)
In reply to this post by Tanya Gray (Oxford)
Stephen, thank you v much for your suggestion. It resolves the problems encountered using a dynamic model (xml instances generate using xpl) with a static view (xslt). However, this approach does still require prior knowledge of the structure of the XML instance as the nodeset paths are hard-coded, and the XSLT file would need to be updated if the structure of the XML Schema and XML instance were to change.

I'd just like to make the point, that it would be a great bonus if it were possible to generate an xforms input form using a dynamic view, i.e. an XSLT file generated in an XPL pipeline. This would allow, for instance, select box values to be populated from the values defined in an XML Schema, and would greatly reduce the time required to update the XSLT file if the XML Schema were to change. I would be interested to know if there are any plans to implement code in ops to generate an XFORMS input form with field binding to the relevant XML instance elements, using XSLT, or if, in fact, it already exists!

Tanya









>>> [hidden email] 12/01/05 4:08 PM >>>
I'd suggest instead you take a look at xforms:repeat.

I have an example where I've got an instance doc in this format
(actually this gets into the page using <xsl:copy-of
select="doc('input:instance')"/>:
<instance>
        <queryDef>
                <properties>
                        <property id="Title" displayName="Title">
                                <value></value>
                        </property>
                        <property id="Author" displayName="Author">
                                <value></value>
                        </property>
                        (etc)
                </properties>
        <queryDef>
<instance>

Then to generate my input controls, I use something along the lines of:

<!-- group based on the main instance -->
<xforms:group ref="instance('instance')">
        <xhtml:table>
                <!-- repeat on each property node -->
                <xforms:repeat nodesset="queryDef/properties/property">
                        <xhtml:tr>
                                <xhtml:td>
                                        <!-- first cell in row is the
displayName attribute of the property node -->
                                        <xforms:output
ref="@displayName"/>
                                </xhtml:td>
                                <xhtml:td>
                                        <!-- input control references
the value node beneath the property node -->
                                        <xforms:input ref="value"/>
                                </xhtml:td>
                        </xhtml:tr>
                </xforms:repeat>
        </xhtml:table>
</xforms:group>

This is a somewhat trimmed-down version of the sort of thing that might
suit what you're doing.  It should give you some idea anyway.

-----Original Message-----
From: Tanya Gray [mailto:[hidden email]]
Sent: 01 December 2005 15:41
To: [hidden email]; [hidden email]
Subject: [ops-users] xslt & xforms

Hello

a quick question. I would like to auto-generate an xforms input form
from a dynamically-generated XML instance, using XSLT. The problem I've
encountered is one of how to bind an xforms:input field to the relevant
element in the XML instance.

With a static XSLT file, you would use something like <xforms:input
ref="ns:element_name"/> to bind an input field to the element in the XML
instance. Using a dynamically generated XSLT file, is it possible to
populate the ref property in an <xsl:for-each> statement, as shown
below?

<xsl:template match="/">
<xsl:for-each select="//*">
<xforms:input ref="ns:xml_element_name">
</xsl:for-each>
</xsl:template>

Also, just to say, I needed to use this approach as I found that when
using a static XSLT file to transform an XML instance to an XFORMS input
form, if there were XFORMS input fields in the XSLT file that referenced
non-existence XML instance elements, this caused an error in the input
form. This presents a problem when you have auto-generated XML instances
and want to display an input form based on those instances using just
one XSLT file. If anyone has had similar experiences I would be
interested to discuss.

regards
Tanya







 








has anyone transformed an xml instance file to an xforms input form,
using xslt.













--
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
Reply | Threaded
Open this post in threaded view
|

Re: xslt & xforms

Alexander Žaťko
Tanya,

If I understand correctly what you are saying, you are looking for a
"mechanism" that would convert an arbitrary XML into an XForm page? I
do not think OPS has anything like that built-in. To build such a thing
- depending on how generic a solution is needed - is not going to be
trivial. These issues come immediately to mind:

1) XML contains several node types (elements, attributes) that can be
"manifested" in the view as XForms input or output. The information
about a particular node selection would need to be captured somewhere.

2) an XML can have big number of nodes - there will again need to be a
way to specify which ones are interesting for a particular page

3) positional and styling issues, like - where should a particular
widget be placed and how to style it - will need to be described

4) issues around user interaction with the form - required fields, form
field value pattern enforcement, alerts, hints...

If you want to build multi-page forms (web apps really), the situation
becomes even more interesting as you have to describe the page flow
somehow, but while you posted your question to the OPS list, I assume
you do not want to automate this part as you would use the pipeline
framework.

It should be feasible though to create a less generic mechanism which
you probably had in mind anyway. Possibly I misunderstood your problem?

A.


On Dec 1, 2005, at 4:33 PM, Tanya Gray wrote:

> Stephen, thank you v much for your suggestion. It resolves the
> problems encountered using a dynamic model (xml instances generate
> using xpl) with a static view (xslt). However, this approach does
> still require prior knowledge of the structure of the XML instance as
> the nodeset paths are hard-coded, and the XSLT file would need to be
> updated if the structure of the XML Schema and XML instance were to
> change.
>
> I'd just like to make the point, that it would be a great bonus if it
> were possible to generate an xforms input form using a dynamic view,
> i.e. an XSLT file generated in an XPL pipeline. This would allow, for
> instance, select box values to be populated from the values defined in
> an XML Schema, and would greatly reduce the time required to update
> the XSLT file if the XML Schema were to change. I would be interested
> to know if there are any plans to implement code in ops to generate an
> XFORMS input form with field binding to the relevant XML instance
> elements, using XSLT, or if, in fact, it already exists!
>
> Tanya
>
>>>> [hidden email] 12/01/05 4:08 PM >>>
> I'd suggest instead you take a look at xforms:repeat.
>
> I have an example where I've got an instance doc in this format
> (actually this gets into the page using <xsl:copy-of
> select="doc('input:instance')"/>:
> <instance>
> <queryDef>
> <properties>
> <property id="Title" displayName="Title">
> <value></value>
> </property>
> <property id="Author" displayName="Author">
> <value></value>
> </property>
> (etc)
> </properties>
> <queryDef>
> <instance>
>
> Then to generate my input controls, I use something along the lines of:
>
> <!-- group based on the main instance -->
> <xforms:group ref="instance('instance')">
> <xhtml:table>
> <!-- repeat on each property node -->
> <xforms:repeat nodesset="queryDef/properties/property">
> <xhtml:tr>
> <xhtml:td>
> <!-- first cell in row is the
> displayName attribute of the property node -->
> <xforms:output
> ref="@displayName"/>
> </xhtml:td>
> <xhtml:td>
> <!-- input control references
> the value node beneath the property node -->
> <xforms:input ref="value"/>
> </xhtml:td>
> </xhtml:tr>
> </xforms:repeat>
> </xhtml:table>
> </xforms:group>
>
> This is a somewhat trimmed-down version of the sort of thing that might
> suit what you're doing.  It should give you some idea anyway.
>
> -----Original Message-----
> From: Tanya Gray [mailto:[hidden email]]
> Sent: 01 December 2005 15:41
> To: [hidden email]; [hidden email]
> Subject: [ops-users] xslt & xforms
>
> Hello
>
> a quick question. I would like to auto-generate an xforms input form
> from a dynamically-generated XML instance, using XSLT. The problem I've
> encountered is one of how to bind an xforms:input field to the relevant
> element in the XML instance.
>
> With a static XSLT file, you would use something like <xforms:input
> ref="ns:element_name"/> to bind an input field to the element in the
> XML
> instance. Using a dynamically generated XSLT file, is it possible to
> populate the ref property in an <xsl:for-each> statement, as shown
> below?
>
> <xsl:template match="/">
> <xsl:for-each select="//*">
> <xforms:input ref="ns:xml_element_name">
> </xsl:for-each>
> </xsl:template>
>
> Also, just to say, I needed to use this approach as I found that when
> using a static XSLT file to transform an XML instance to an XFORMS
> input
> form, if there were XFORMS input fields in the XSLT file that
> referenced
> non-existence XML instance elements, this caused an error in the input
> form. This presents a problem when you have auto-generated XML
> instances
> and want to display an input form based on those instances using just
> one XSLT file. If anyone has had similar experiences I would be
> interested to discuss.
>
> regards
> Tanya
>
>
>
> has anyone transformed an xml instance file to an xforms input form,
> using xslt.
>
>
> --
> 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



--
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
Reply | Threaded
Open this post in threaded view
|

Re: xslt & xforms

Alessandro  Vernet
Administrator
In reply to this post by Tanya Gray (Oxford)
Tanya,

In your XSLT code, try using the saxon:path() function. This is a
Saxon-specific extension function that will return an XPath expression
identifying the current node. So you should be able to use that to
generate your ref, as in:

<xforms:input ref="{saxon:path()}"/>

Alex

On 12/1/05, Tanya Gray <[hidden email]> wrote:

> Hello
>
> a quick question. I would like to auto-generate an xforms input form from a dynamically-generated XML instance, using XSLT. The problem I've encountered is one of how to bind an xforms:input field to the relevant element in the XML instance.
>
> With a static XSLT file, you would use something like <xforms:input ref="ns:element_name"/> to bind an input field to the element in the XML instance. Using a dynamically generated XSLT file, is it possible to populate the ref property in an <xsl:for-each> statement, as shown below?
>
> <xsl:template match="/">
> <xsl:for-each select="//*">
> <xforms:input ref="ns:xml_element_name">
> </xsl:for-each>
> </xsl:template>
>
> Also, just to say, I needed to use this approach as I found that when using a static XSLT file to transform an XML instance to an XFORMS input form, if there were XFORMS input fields in the XSLT file that referenced non-existence XML instance elements, this caused an error in the input form. This presents a problem when you have auto-generated XML instances and want to display an input form based on those instances using just one XSLT file. If anyone has had similar experiences I would be interested to discuss.
>
> regards
> Tanya
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> has anyone transformed an xml instance file to an xforms input form, using xslt.
>
>
>
>
>
>
>
>
>
>
> --
> 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
>
>
>

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

RE: xslt & xforms

Stephen Bayliss
In reply to this post by Tanya Gray (Oxford)
Tanya,

Do you have some examples of what you are trying to achieve; ie examples
of the xml instance documents, how they differ, the kind of schema
changes you are trying to accommodate, and the reason why?

Then maybe we can give some creative suggestions.

Steve

-----Original Message-----
From: Alexander Zatko [mailto:[hidden email]]
Sent: 01 December 2005 23:04
To: [hidden email]
Subject: Re: [ops-users] xslt & xforms

Tanya,

If I understand correctly what you are saying, you are looking for a
"mechanism" that would convert an arbitrary XML into an XForm page? I
do not think OPS has anything like that built-in. To build such a thing
- depending on how generic a solution is needed - is not going to be
trivial. These issues come immediately to mind:

1) XML contains several node types (elements, attributes) that can be
"manifested" in the view as XForms input or output. The information
about a particular node selection would need to be captured somewhere.

2) an XML can have big number of nodes - there will again need to be a
way to specify which ones are interesting for a particular page

3) positional and styling issues, like - where should a particular
widget be placed and how to style it - will need to be described

4) issues around user interaction with the form - required fields, form
field value pattern enforcement, alerts, hints...

If you want to build multi-page forms (web apps really), the situation
becomes even more interesting as you have to describe the page flow
somehow, but while you posted your question to the OPS list, I assume
you do not want to automate this part as you would use the pipeline
framework.

It should be feasible though to create a less generic mechanism which
you probably had in mind anyway. Possibly I misunderstood your problem?

A.


On Dec 1, 2005, at 4:33 PM, Tanya Gray wrote:

> Stephen, thank you v much for your suggestion. It resolves the
> problems encountered using a dynamic model (xml instances generate
> using xpl) with a static view (xslt). However, this approach does
> still require prior knowledge of the structure of the XML instance as
> the nodeset paths are hard-coded, and the XSLT file would need to be
> updated if the structure of the XML Schema and XML instance were to
> change.
>
> I'd just like to make the point, that it would be a great bonus if it
> were possible to generate an xforms input form using a dynamic view,
> i.e. an XSLT file generated in an XPL pipeline. This would allow, for
> instance, select box values to be populated from the values defined in

> an XML Schema, and would greatly reduce the time required to update
> the XSLT file if the XML Schema were to change. I would be interested
> to know if there are any plans to implement code in ops to generate an

> XFORMS input form with field binding to the relevant XML instance
> elements, using XSLT, or if, in fact, it already exists!
>
> Tanya
>
>>>> [hidden email] 12/01/05 4:08 PM >>>
> I'd suggest instead you take a look at xforms:repeat.
>
> I have an example where I've got an instance doc in this format
> (actually this gets into the page using <xsl:copy-of
> select="doc('input:instance')"/>:
> <instance>
> <queryDef>
> <properties>
> <property id="Title" displayName="Title">
> <value></value>
> </property>
> <property id="Author" displayName="Author">
> <value></value>
> </property>
> (etc)
> </properties>
> <queryDef>
> <instance>
>
> Then to generate my input controls, I use something along the lines
of:

>
> <!-- group based on the main instance -->
> <xforms:group ref="instance('instance')">
> <xhtml:table>
> <!-- repeat on each property node -->
> <xforms:repeat nodesset="queryDef/properties/property">
> <xhtml:tr>
> <xhtml:td>
> <!-- first cell in row is the
> displayName attribute of the property node -->
> <xforms:output
> ref="@displayName"/>
> </xhtml:td>
> <xhtml:td>
> <!-- input control references
> the value node beneath the property node -->
> <xforms:input ref="value"/>
> </xhtml:td>
> </xhtml:tr>
> </xforms:repeat>
> </xhtml:table>
> </xforms:group>
>
> This is a somewhat trimmed-down version of the sort of thing that
might

> suit what you're doing.  It should give you some idea anyway.
>
> -----Original Message-----
> From: Tanya Gray [mailto:[hidden email]]
> Sent: 01 December 2005 15:41
> To: [hidden email]; [hidden email]
> Subject: [ops-users] xslt & xforms
>
> Hello
>
> a quick question. I would like to auto-generate an xforms input form
> from a dynamically-generated XML instance, using XSLT. The problem
I've
> encountered is one of how to bind an xforms:input field to the
relevant

> element in the XML instance.
>
> With a static XSLT file, you would use something like <xforms:input
> ref="ns:element_name"/> to bind an input field to the element in the
> XML
> instance. Using a dynamically generated XSLT file, is it possible to
> populate the ref property in an <xsl:for-each> statement, as shown
> below?
>
> <xsl:template match="/">
> <xsl:for-each select="//*">
> <xforms:input ref="ns:xml_element_name">
> </xsl:for-each>
> </xsl:template>
>
> Also, just to say, I needed to use this approach as I found that when
> using a static XSLT file to transform an XML instance to an XFORMS
> input
> form, if there were XFORMS input fields in the XSLT file that
> referenced
> non-existence XML instance elements, this caused an error in the input
> form. This presents a problem when you have auto-generated XML
> instances
> and want to display an input form based on those instances using just
> one XSLT file. If anyone has had similar experiences I would be
> interested to discuss.
>
> regards
> Tanya
>
>
>
> has anyone transformed an xml instance file to an xforms input form,
> using xslt.
>
>
> --
> 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






--
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
Reply | Threaded
Open this post in threaded view
|

Re: Comments placed in Pipelines and performance

Brian Bacsu
In reply to this post by Alessandro Vernet

Hi

I am wondering how the number, and length, of comments placed in pipelines, for documentation purposes, affects their performance?

Thanks,

Brian Bacsu


--
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Comments placed in Pipelines and performance

Erik Bruchez
Administrator
That should not affect performance much if at all. The only time where
performance could be impacted is at parsing, as later comments are
discarded by the XPL engine.

-Erik

Brian Bacsu wrote:
>
> Hi
>
> I am wondering how the number, and length, of comments placed in
> pipelines, for documentation purposes, affects their performance?
>
> Thanks,
>
> Brian Bacsu



--
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