Quantcast

Command line example to transform huge file using stream with saxon-EE

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Command line example to transform huge file using stream with saxon-EE

Vincent Cestmois
Hi,

I have a huge (1.75 GB) XML 1.0 document, which I need to transform with a 3kb Xlst 1.0 stylesheet.
I know I need saxon-EE and it's stream capability.

However I can't find how to invoke the stream capability from the command line, as -xsl:streamdeosn't work, because -xsl: requires the filename

Also, I don't want to modify the files (but it seam that the xsl:stream has to be put in the xslt file, which i don't want to)

I'm a noob, I just want a simple example, something like that

java -jar /SaxonEE9-7-0-8J/saxon9ee.jar  -xsl:MyXSLT.xslt -s:Source.xml -o:Output.xml 

Thanks for your help



------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Command line example to transform huge file using stream with saxon-EE

Martin Honnen-2
On 07.09.2016 12:49, Vincent Cestmois wrote:

> I have a huge (1.75 GB) XML 1.0 document, which I need to transform with
> a 3kb Xlst 1.0 stylesheet.

You would need to edit the stylesheet and add

   <xsl:mode streamable="yes"/>

> I know I need saxon-EE and it's stream capability.

Then, with java -jar /SaxonEE9-7-0-8J/saxon9ee.jar  -xsl:MyXSLT.xslt
-s:Source.xml -o:Output.xml, Saxon will tell you whether it considers
the XSLT streamable.



------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Command line example to transform huge file using stream with saxon-EE

Michael Kay
In reply to this post by Vincent Cestmois
To do streaming, you will need to make changes to your stylesheet. At the very least you need to declare it streamable by adding

<xsl:mode streamable="yes"/>

which will cause Saxon to check that the code in the stylesheet is actually streamable. If you're lucky, no further changes will be needed, but it's much more likely that you will need to make some changes to fit with the constraints that streaming imposes.

If the initial mode is declared streamable, then you can run a streaming transformation from the command like using exactly the example you've given - you don't need xsl:stream.

If you don't want to modify the existing stylesheet, you can always add a wrapper module:

<xsl:stylesheet ...>
  <xsl:include href="existing-stylesheet.xsl"/>
  <xsl:mode streamable="yes"/>
</xsl:stylesheet>

and use that as your entry point.

Michael Kay
Saxonica


On 7 Sep 2016, at 11:49, Vincent Cestmois <[hidden email]> wrote:

Hi,

I have a huge (1.75 GB) XML 1.0 document, which I need to transform with a 3kb Xlst 1.0 stylesheet.
I know I need saxon-EE and it's stream capability.

However I can't find how to invoke the stream capability from the command line, as -xsl:streamdeosn't work, because -xsl: requires the filename

Also, I don't want to modify the files (but it seam that the xsl:stream has to be put in the xslt file, which i don't want to)

I'm a noob, I just want a simple example, something like that

java -jar /SaxonEE9-7-0-8J/saxon9ee.jar  -xsl:MyXSLT.xslt -s:Source.xml -o:Output.xml 

Thanks for your help


------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Command line example to transform huge file using stream with saxon-EE

Vincent Cestmois
In reply to this post by Vincent Cestmois
Many thanks Michael,

I'll try to modify the Xslt as I don't know where to add the wrapper you provided

Interestingly, 3 hours ago, while doing my research, I launched the command but with -xsltversion:3.0 flag.

And it's still crunching without errors, but before I tried it without that 3.0 flag and it failed due to heap space

java -jar /SaxonEE9-7-0-8J/saxon9ee.jar  -xsl:MyXSLT.xslt -s:Source.xml -xsltversion:3.0


So does 3.0 tries streaming by default (I thought it does not) ?

------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Command line example to transform huge file using stream with saxon-EE

Michael Kay

> On 7 Sep 2016, at 13:24, Vincent Cestmois <[hidden email]> wrote:
>
> Many thanks Michael,
>
> I'll try to modify the Xslt as I don't know where to add the wrapper you provided
>
> Interestingly, 3 hours ago, while doing my research, I launched the command but with -xsltversion:3.0 flag.
>
> And it's still crunching without errors, but before I tried it without that 3.0 flag and it failed due to heap space
>
> java -jar /SaxonEE9-7-0-8J/saxon9ee.jar  -xsl:MyXSLT.xslt -s:Source.xml -xsltversion:3.0
>
>
> So does 3.0 tries streaming by default (I thought it does not) ?

I would suggest adding -t to the command line as you will then get very quick feedback on whether streaming is being attempted or not.

But Saxon won't attempt streaming unless you ask for it somewhere.

Michael Kay
Saxonica



------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...