Tip: using saxon:parse in xforms:insert @origin attribute

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

Tip: using saxon:parse in xforms:insert @origin attribute

Pascal Heus
The introduction of the @origin attribute in xforms:insert provides a wide range of new capabilities.
One thing that was still bothering me though was the need to declare the document source in an external instance.
Just found an alternate approach: using saxon:parse() to generate the nodeset to insert.

For example, the following will insert the <hello/> node:
<xforms:insert context="." nodeset="*" origin="saxon:parse(string('&lt;a:Location/&gt;'))" at="1" position="before"/>

It's a bit more tricky if you need an element prefix as the namespace must also be declared in the string as in:
<xforms:insert context="." nodeset="*" origin="saxon:parse(string('&lt;a:Location xmlns:a=&quot;ddi:archive:0_1&quot; /&gt;'))" at="1" position="before"/>
(the abovve inserts <a:Location/>)

This might be obvious to our XSL gurus on the list but thought it might be useful to others (there night also be a better way?)

Now, ideally, it would be much nicer to be able to write:
<xforms:insert context="." nodeset="*" at="1" position="before">
    <a:Location/>
</xforms:insert>
On the wish list for XForms 1.2?

cheers
*P




--
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: Tip: using saxon:parse in xforms:insert @origin attribute

Erik Bruchez
Administrator
Pascal,

Thanks for this useful tip. Your syntax suggestion sounds interesting. I
forwarded it to the XForms Working Group. Don't hold your breath though
as we are still working on XForms 1.1 ;-)

-Erik

Pascal Heus wrote:

> The introduction of the @origin attribute in xforms:insert provides a
> wide range of new capabilities.
> One thing that was still bothering me though was the need to declare the
> document source in an external instance.
> Just found an alternate approach: using saxon:parse() to generate the
> nodeset to insert.
>
> For example, the following will insert the <hello/> node:
> <xforms:insert context="." nodeset="*"
> *origin="saxon:parse(string('&lt;a:Location/&gt;'))" *at="1"
> position="before"/>
>
> It's a bit more tricky if you need an element prefix as the namespace
> must also be declared in the string as in:
> <xforms:insert context="." nodeset="*"
> *origin="saxon:parse(string('&lt;a:Location
> xmlns:a=&quot;ddi:archive:0_1&quot; /&gt;'))"* at="1" position="before"/>
> (the abovve inserts <a:Location/>)
>
> This might be obvious to our XSL gurus on the list but thought it might
> be useful to others (there night also be a better way?)
>
> Now, ideally, it would be much nicer to be able to write:
> <xforms:insert context="." nodeset="*" **at="1" position="before">
>     <a:Location/>
> </xforms:insert>
> On the wish list for XForms 1.2?
>
> cheers
> *P
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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

--
Orbeon - XForms Everywhere:
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