Project

Profile

Help

Should using !saxon:next-in-chain=test201708180302.xsl work from the command line with Saxon 9.8?

Added by Martin Honnen over 6 years ago

I am trying to get two stylesheets chained with Saxon 9.8.0.4J EE from the command line, when I try

java -jar 'C:\Program Files\Saxonica\Saxon9.8EE\saxon9ee.jar' -t -xsl:.\test201708180301.xsl -s:.\test2017081803.xml !saxon:next-in-chain=test201708180302.xsl

in a Windows Powershell window it seems only @test201708180301.xsl@ is applied, the @!saxon:next-in-chain=test201708180302.xsl@ is ignored.

I first thought I had the wrong syntax but when I try to do the same with HE it tells me

java.lang.IllegalArgumentException: Serialization parameter {{http://saxon.sf.net/}next-in-...} not available in Saxon-HE

so I seem to have the right syntax.

The samples are (both stylesheets)




    
    
    
    
        
        
    
    

input




    test

Output



    test

My original intent was to test whether @saxon:next-in-chain@ works with streaming but I have now reduced everything to a minimum of two conventional stylesheets which don't seem to be chainable from the command line.

Any thoughts?

I have seen https://saxonica.plan.io/issues/2782 but that says it fixed it on 9.7 and 9.8 and four scenarios, including the "command line".


Replies (4)

Please register to reply

RE: Should using !saxon:next-in-chain=test201708180302.xsl work from the command line with Saxon 9.8? - Added by Michael Kay over 6 years ago

Oh dear, I wish saxon:next-in-chain had never been invented...

It doesn't work as a serialization property on the command line; that's because the command line sets up a s9api Serializer as the destination, and then sets the "!"-flagged properties as options on the s9api Serializer, and the s9api Serializer explicilty ignores saxon:next-in-chain because it has nothing to do with serialization.

I think I'm going to handle this by having Serializer.setOutputProperty() produce an error for this case rather than ignore the parameter.

RE: Should using !saxon:next-in-chain=test201708180302.xsl work from the command line with Saxon 9.8? - Added by Martin Honnen over 6 years ago

As I also tried unsuccessfully to use @saxon:next-in-chain@ using Java and .NET and the @Serializer@ class together with @Xslt30Transformer@, what would be the right class and right method to set @saxon:next-in-chain@ via the API in Java and .NET, when using @Xslt30Transformer@?

RE: Should using !saxon:next-in-chain=test201708180302.xsl work from the command line with Saxon 9.8? - Added by Michael Kay over 6 years ago

I don't think saxon:next-in-chain is the right mechanism to build a pipeline of transformations programmatically. Just run the two transformations directly from the API, feeding the output of one to be the input of the next. (XsltTransformer implements Destination, so you can directly supply one transformation as the destination of another. This doesn't work with Xslt30Transformer, because of the greater variety of inputs and outputs to a transformation that are now available.)

RE: Should using !saxon:next-in-chain=test201708180302.xsl work from the command line with Saxon 9.8? - Added by Michael Kay over 6 years ago

Note that the documentation (in both 9.7 and 9.8) says:

This serialization property is available only on xsl:output declarations. It cannot be supplied as an attribute to xsl:result-document or in any of the various APIs that control serialization.

However, I believe this is not quite accurate: use of the attribute on xsl:result-document should work.

    (1-4/4)

    Please register to reply