saxon:transform function

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

saxon:transform function

mangvlad
I am trying to use saxon:transform function in my form and having problems converting instance to a document-node.

I have this code that works (test.xml has XSLT and test-data.xml has "hard coded" data that are identical to the data in my main instance):

<xforms:output value="saxon:transform(saxon:compile-stylesheet(doc('http://localhost:7011/orbeon/apps/files/test.xml')),doc('http://localhost:7011/orbeon/apps/files/test-data.xml'))//FullName"/>


When I try to replace doc('http://localhost:7011/orbeon/apps/files/test-data.xml') with instance('main') I get:

"Externally supplied NodeInfo belongs to the wrong Configuration"

If I try to use saxon:parse, I loose all my XML and have only values (I can select <test> but not any elements that my instance had. Instead only values of all elements are there):

<xforms:output
value=
"(saxon:transform(saxon:compile-stylesheet(doc('http://localhost:7011/orbeon/apps/files/test.xml')), saxon:parse(concat('&lt;test>',instance('main'), '</test>'))))"
/>

Is there a function in XPath that can help to "convert" instance to a document-node()?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: saxon:transform function

Erik Bruchez
Administrator
We don't have such a function.

As a hack, you could try saxon:parse(saxon:serialize(instance('main'),  
'xml'))

-Erik

On Jul 7, 2008, at 10:18 AM, mangvlad wrote:

>
> I am trying to use saxon:transform function in my form and having  
> problems
> converting instance to a document-node.
>
> I have this code that works (test.xml has XSLT and test-data.xml has  
> "hard
> coded" data that are identical to the data in my main instance):
>
> <xforms:output
> value="saxon:transform(saxon:compile-stylesheet(doc('http://localhost:7011/orbeon/apps/files/test.xml')),doc('http://localhost:7011/orbeon/apps/files/test-data.xml'))//FullName 
> "/>
>
>
> When I try to replace
> doc('http://localhost:7011/orbeon/apps/files/test-data.xml') with
> instance('main') I get:
>
> "Externally supplied NodeInfo belongs to the wrong Configuration"
>
> If I try to use saxon:parse, I loose all my XML and have only values  
> (I can
> select <test> but not any elements that my instance had. Instead  
> only values
> of all elements are there):
>
> <xforms:output
> value=
> "(saxon:transform(saxon:compile-stylesheet(doc('http://localhost:7011/orbeon/apps/files/test.xml'))
> ,
> saxon:parse(concat('&lt;test>',instance('main'), '&lt;/test>'))))"
> />
>
> Is there a function in XPath that can help to "convert" instance to a
> document-node()?
>
> Thanks.
>
> --
> View this message in context: http://www.nabble.com/saxon%3Atransform-function-tp18321851p18321851.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: saxon:transform function

mangvlad
Erik Bruchez wrote
We don't have such a function.

As a hack, you could try saxon:parse(saxon:serialize(instance('main'),  
'xml'))
That works, thanks!

As a follow up, can you elaborate a bit more on "We don't have such a function."?
(I understand that it is not part of the XForms spec, but since it is there in Saxon, it will work as long as it is Saxon? Is it even possible to switch from Saxon to something else (maybe AltovaXML) without "breaking" many features?)

Also, if I use this "hack" what are the consequences? :)
(Using this will allow me to solve several problems I am having: sorting by "labels", allowing custom functions as bind expressions, etc.)

(It seems that I am still struggling to see a "Big Picture" of Orbeon and it's relationship with other technologies...)

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Re: saxon:transform function

Erik Bruchez
Administrator
> That works, thanks!

Great.

> As a follow up, can you elaborate a bit more on "We don't have such a
> function."?
> (I understand that it is not part of the XForms spec, but since it  
> is there
> in Saxon, it will work as long as it is Saxon?

Not sure what you are asking for here. You asked "Is there a function  
in XPath that can help to "convert" instance to a document-node()?".  
We don't have one specifically for that purpose, that's all I was  
saying. Ideally of course you wouldn't get the Saxon error in the  
first place when just using saxon:transform(), but that's arguably a  
bug (or missing feature) in Orbeon Forms.

> Is it even possible to switch
> from Saxon to something else (maybe AltovaXML) without "breaking" many
> features?)

I wouldn't say "impossible", but that's pretty close: the XForms  
engine is tightly integrated with the Saxon XPath engine and data  
structures. Also, I don't think the Altova stuff is written in Java.

If you are just asking about calling an external XSLT transformation,  
then you could certainly figure out how to use another XSLT transformer.

> Also, if I use this "hack" what are the consequences? :)
>
> (Using this will allow me to solve several problems I am having:  
> sorting by
> "labels", allowing custom functions as bind expressions, etc.)

It's probably not very efficient, but besides that, if it works, great!

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: saxon:transform function

mangvlad
Erik Bruchez wrote
Not sure what you are asking for here. You asked "Is there a function  
in XPath that can help to "convert" instance to a document-node()?".  
We don't have one specifically for that purpose, that's all I was  
saying. Ideally of course you wouldn't get the Saxon error in the  
first place when just using saxon:transform(), but that's arguably a  
bug (or missing feature) in Orbeon Forms.
Sorry, I re-read your answer again and I understand now.

Erik Bruchez wrote
I wouldn't say "impossible", but that's pretty close: the XForms  
engine is tightly integrated with the Saxon XPath engine and data  
structures. Also, I don't think the Altova stuff is written in Java.

If you are just asking about calling an external XSLT transformation,  
then you could certainly figure out how to use another XSLT transformer.
Altova claims on they Website that they have a JAR file that implements XPath 2.0, XSLT 2.0 and XQuery 1.0 and it is "the only free" implementation that has XSD support and is "many times" faster than Saxon. (I have not used it myself, but at some point it may be an interesting exercise):

http://www.altova.com/xml_engines.html

Erik Bruchez wrote
It's probably not very efficient, but besides that, if it works, great!
Do you think it is something that can be improved at some point in the future?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: saxon:transform function

Alessandro Vernet
Administrator
On Mon, Jul 7, 2008 at 6:34 PM, mangvlad <[hidden email]> wrote:
> Altova claims on they Website that they have a JAR file that implements
> XPath 2.0, XSLT 2.0 and XQuery 1.0 and it is "the only free" implementation
> that has XSD support and is "many times" faster than Saxon. (I have not used
> it myself, but at some point it may be an interesting exercise):

I wouldn't pay too much attention to those claims. See this post from
Michael Kay for another perspective from the author of Saxon:

http://saxonica.blogharbor.com/blog/_archives/2006/10/28/2454935.html

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: saxon:transform function

sirrahzil
Altova actually lists the specific testing environment they used for this result as well...

Details about internal AltovaXML and Saxon performance testing:

    * Test platform: Windows PC with a 3 GHz P4 CPU and 2 GB RAM
    * Files used for testing: a selection of 1,127 test files from the official W3C test suite for XSLT 2.0
    * Test method: a single shell script (batch file) calling the engine being tested once for each test file and measuring the overall time for the entire execution of the batch run
    * Tests performed using the following versions: AltovaXML v2007 vs. Saxon-SA 8.7J (using Java 1.5.0_06)
    * Test result processing times: Saxon = 22 minutes, AltovaXML = 6 minutes 46 seconds


Alessandro Vernet wrote
On Mon, Jul 7, 2008 at 6:34 PM, mangvlad <mangvlad@gmail.com> wrote:
> Altova claims on they Website that they have a JAR file that implements
> XPath 2.0, XSLT 2.0 and XQuery 1.0 and it is "the only free" implementation
> that has XSD support and is "many times" faster than Saxon. (I have not used
> it myself, but at some point it may be an interesting exercise):

I wouldn't pay too much attention to those claims. See this post from
Michael Kay for another perspective from the author of Saxon:

http://saxonica.blogharbor.com/blog/_archives/2006/10/28/2454935.html

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws


-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: saxon:transform function

Hank Ratzesberger

Of course Altova has a number of good products....

Dr. Kay's point is that the tests include the load times
for Java, the libraries, etc.  A program may be larger, and
load slower, yet run faster. So, it is not a thorough
comparison, particularly in this server environment, where
it is resident in memory whenever used (barring swapping by
the OS).

His technical writing is outstanding.

--Hank


On Jul 18, 2008, at 8:24 AM, sirrahzil wrote:

>
> Altova actually lists the specific testing environment they used  
> for this
> result as well...
>
> Details about internal AltovaXML and Saxon performance testing:
>
>     * Test platform: Windows PC with a 3 GHz P4 CPU and 2 GB RAM
>     * Files used for testing: a selection of 1,127 test files from the
> official W3C test suite for XSLT 2.0
>     * Test method: a single shell script (batch file) calling the  
> engine
> being tested once for each test file and measuring the overall time  
> for the
> entire execution of the batch run
>     * Tests performed using the following versions: AltovaXML v2007  
> vs.
> Saxon-SA 8.7J (using Java 1.5.0_06)
>     * Test result processing times: Saxon = 22 minutes, AltovaXML = 6
> minutes 46 seconds
>
>
>
> Alessandro Vernet wrote:
>>
>> On Mon, Jul 7, 2008 at 6:34 PM, mangvlad <[hidden email]> wrote:
>>> Altova claims on they Website that they have a JAR file that  
>>> implements
>>> XPath 2.0, XSLT 2.0 and XQuery 1.0 and it is "the only free"
>>> implementation
>>> that has XSD support and is "many times" faster than Saxon. (I  
>>> have not
>>> used
>>> it myself, but at some point it may be an interesting exercise):
>>
>> I wouldn't pay too much attention to those claims. See this post from
>> Michael Kay for another perspective from the author of Saxon:
>>
>> http://saxonica.blogharbor.com/blog/_archives/2006/10/28/2454935.html
>>
>> Alex
>> --
>> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
>> Orbeon's Blog: http://www.orbeon.com/blog/
>> Personal Blog: http://avernet.blogspot.com/
>> Twitter - http://twitter.com/avernet
>>
>>
>> --
>> 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
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>>
>> -----
>> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
>> http://www.orbeon.com/
>>
>>
>
> --
> View this message in context: <a href="http://www.nabble.com/saxon%">http://www.nabble.com/saxon% 
> 3Atransform-function-tp18321851p18531726.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.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
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
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
OW2 mailing lists service home page: http://www.ow2.org/wws