Quantcast

Destination chaining problem

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

Destination chaining problem

cmarchand

Hello,

using setDestination(...), I chain :

  • a first identity XSL,
  • a java class that extends ProxyReceiver, and adds a test attribute on each element
  • a second identity XSL,
  • a Serializer that outputs to a file

When I run this, I have no error, and the destination file is not written.
When I remove the second identity XSL, destination file is written.

As I have no error, it is difficult to understand where the problem is...

The Java class I use is https://github.com/cmarchand/gaulois-pipe/blob/master/src/test/java/fr/efl/chaine/xslt/utils/AttributeAdder.java and is largely inspired by net.sf.saxon.serialize.AttributeSorter

Any help will be appreciated.

Best regards,
Christophe


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

_______________________________________________
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: Destination chaining problem

Michael Kay
I'm sorry, this one falls into the category of "I can only debug code that I can see".

And there's a corrollary: I can only debug code reliably if I can run it and reproduce the symptoms.

Michael Kay
Saxonica


On 24 Nov 2016, at 15:10, Christophe Marchand <[hidden email]> wrote:

Hello,

using setDestination(...), I chain :

  • a first identity XSL,
  • a java class that extends ProxyReceiver, and adds a test attribute on each element
  • a second identity XSL,
  • a Serializer that outputs to a file

When I run this, I have no error, and the destination file is not written.
When I remove the second identity XSL, destination file is written.

As I have no error, it is difficult to understand where the problem is...

The Java class I use is https://github.com/cmarchand/gaulois-pipe/blob/master/src/test/java/fr/efl/chaine/xslt/utils/AttributeAdder.java and is largely inspired by net.sf.saxon.serialize.AttributeSorter

Any help will be appreciated.

Best regards,
Christophe

------------------------------------------------------------------------------
_______________________________________________
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: Destination chaining problem

cmarchand
Ok, I package something.
Thanks,
Christophe

Le 2016-11-24 17:16, Michael Kay a écrit :

> I'm sorry, this one falls into the category of "I can only debug code
> that I can see".
>
> And there's a corrollary: I can only debug code reliably if I can run
> it and reproduce the symptoms.
>
> Michael Kay
> Saxonica
>
>> On 24 Nov 2016, at 15:10, Christophe Marchand <[hidden email]>
>> wrote:
>>
>> Hello,
>>
>> using setDestination(...), I chain :
>>
>> * a first identity XSL,
>>
>> * a java class that extends ProxyReceiver, and adds a test
>> attribute on each element
>> * a second identity XSL,
>> * a Serializer that outputs to a file
>>
>> When I run this, I have no error, and the destination file is not
>> written.
>> When I remove the second identity XSL, destination file is written.
>>
>> As I have no error, it is difficult to understand where the problem
>> is...
>>
>> The Java class I use is
>>
> https://github.com/cmarchand/gaulois-pipe/blob/master/src/test/java/fr/efl/chaine/xslt/utils/AttributeAdder.java
>> and is largely inspired by net.sf.saxon.serialize.AttributeSorter
>>
>> Any help will be appreciated.
>>
>> Best regards,
>> Christophe
>>
> ------------------------------------------------------------------------------
>> _______________________________________________
>> 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

------------------------------------------------------------------------------
_______________________________________________
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: Destination chaining problem

Michael Kay
In reply to this post by cmarchand
It's probably not related to your problem, but I would observe that your AttributeAdder is capable of emitting two attribute events for the same element with the same attribute name, and it's not well defined what subsequent components on the pipeline are likely to do if that happens.

Michael Kay
Saxonica


On 24 Nov 2016, at 15:10, Christophe Marchand <[hidden email]> wrote:

Hello,

using setDestination(...), I chain :

  • a first identity XSL,
  • a java class that extends ProxyReceiver, and adds a test attribute on each element
  • a second identity XSL,
  • a Serializer that outputs to a file

When I run this, I have no error, and the destination file is not written.
When I remove the second identity XSL, destination file is written.

As I have no error, it is difficult to understand where the problem is...

The Java class I use is https://github.com/cmarchand/gaulois-pipe/blob/master/src/test/java/fr/efl/chaine/xslt/utils/AttributeAdder.java and is largely inspired by net.sf.saxon.serialize.AttributeSorter

Any help will be appreciated.

Best regards,
Christophe

------------------------------------------------------------------------------
_______________________________________________
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: Destination chaining problem

cmarchand
In reply to this post by cmarchand
Attached a simple maven project that shows the problem.
mvn package
mvn exec:exec

And you are right, I have to check the attributes I write !

Thanks in advance,
Christophe

Le 2016-11-24 17:19, [hidden email] a écrit :

> Ok, I package something.
> Thanks,
> Christophe
>
> Le 2016-11-24 17:16, Michael Kay a écrit :
>> I'm sorry, this one falls into the category of "I can only debug code
>> that I can see".
>>
>> And there's a corrollary: I can only debug code reliably if I can run
>> it and reproduce the symptoms.
>>
>> Michael Kay
>> Saxonica
>>
>>> On 24 Nov 2016, at 15:10, Christophe Marchand <[hidden email]>
>>> wrote:
>>>
>>> Hello,
>>>
>>> using setDestination(...), I chain :
>>>
>>> * a first identity XSL,
>>>
>>> * a java class that extends ProxyReceiver, and adds a test
>>> attribute on each element
>>> * a second identity XSL,
>>> * a Serializer that outputs to a file
>>>
>>> When I run this, I have no error, and the destination file is not
>>> written.
>>> When I remove the second identity XSL, destination file is written.
>>>
>>> As I have no error, it is difficult to understand where the problem
>>> is...
>>>
>>> The Java class I use is
>>>
>> https://github.com/cmarchand/gaulois-pipe/blob/master/src/test/java/fr/efl/chaine/xslt/utils/AttributeAdder.java
>>> and is largely inspired by net.sf.saxon.serialize.AttributeSorter
>>>
>>> Any help will be appreciated.
>>>
>>> Best regards,
>>> Christophe
>>>
>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> 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
>
> ------------------------------------------------------------------------------
> _______________________________________________
> 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 

javaStepBug.tar.gz (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Destination chaining problem

Michael Kay
It turns out that the problem is failure to call Destination.close() on the XsltTransformer acting as a Destination. Unless it's a streaming XSLT 3.0 transformation, it's the call on close() that actually triggers the transformation to start - until then all that's been happening is to build the tree (the source tree for that transformation) in memory.

Fixed this by (a) making StepJava.nextStep protected, and (b) implementing AttributeAdder.close() as

public void close() throws SaxonApiException {
    nextStep.close();
}

Michael Kay
Saxonica


> On 24 Nov 2016, at 17:16, [hidden email] wrote:
>
> Attached a simple maven project that shows the problem.
> mvn package
> mvn exec:exec
>
> And you are right, I have to check the attributes I write !
>
> Thanks in advance,
> Christophe
>
> Le 2016-11-24 17:19, [hidden email] a écrit :
>> Ok, I package something.
>> Thanks,
>> Christophe
>> Le 2016-11-24 17:16, Michael Kay a écrit :
>>> I'm sorry, this one falls into the category of "I can only debug code
>>> that I can see".
>>> And there's a corrollary: I can only debug code reliably if I can run
>>> it and reproduce the symptoms.
>>> Michael Kay
>>> Saxonica
>>>> On 24 Nov 2016, at 15:10, Christophe Marchand <[hidden email]>
>>>> wrote:
>>>> Hello,
>>>> using setDestination(...), I chain :
>>>> * a first identity XSL,
>>>> * a java class that extends ProxyReceiver, and adds a test
>>>> attribute on each element
>>>> * a second identity XSL,
>>>> * a Serializer that outputs to a file
>>>> When I run this, I have no error, and the destination file is not
>>>> written.
>>>> When I remove the second identity XSL, destination file is written.
>>>> As I have no error, it is difficult to understand where the problem
>>>> is...
>>>> The Java class I use is
>>> https://github.com/cmarchand/gaulois-pipe/blob/master/src/test/java/fr/efl/chaine/xslt/utils/AttributeAdder.java
>>>> and is largely inspired by net.sf.saxon.serialize.AttributeSorter
>>>> Any help will be appreciated.
>>>> Best regards,
>>>> Christophe
>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> 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
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> saxon-help mailing list archived at http://saxon.markmail.org/
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/saxon-help
> <javaStepBug.tar.gz>------------------------------------------------------------------------------
> _______________________________________________
> 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: Destination chaining problem

cmarchand
That's perfect.
Thanks a lot, Michael.

Best regards,
Christophe


Le 2016-11-24 22:23, Michael Kay a écrit :

> It turns out that the problem is failure to call Destination.close()
> on the XsltTransformer acting as a Destination. Unless it's a
> streaming XSLT 3.0 transformation, it's the call on close() that
> actually triggers the transformation to start - until then all that's
> been happening is to build the tree (the source tree for that
> transformation) in memory.
>
> Fixed this by (a) making StepJava.nextStep protected, and (b)
> implementing AttributeAdder.close() as
>
> public void close() throws SaxonApiException {
>     nextStep.close();
> }
>
> Michael Kay
> Saxonica
>
>
>> On 24 Nov 2016, at 17:16, [hidden email] wrote:
>>
>> Attached a simple maven project that shows the problem.
>> mvn package
>> mvn exec:exec
>>
>> And you are right, I have to check the attributes I write !
>>
>> Thanks in advance,
>> Christophe
>>
>> Le 2016-11-24 17:19, [hidden email] a écrit :
>>> Ok, I package something.
>>> Thanks,
>>> Christophe
>>> Le 2016-11-24 17:16, Michael Kay a écrit :
>>>> I'm sorry, this one falls into the category of "I can only debug
>>>> code
>>>> that I can see".
>>>> And there's a corrollary: I can only debug code reliably if I can
>>>> run
>>>> it and reproduce the symptoms.
>>>> Michael Kay
>>>> Saxonica
>>>>> On 24 Nov 2016, at 15:10, Christophe Marchand
>>>>> <[hidden email]>
>>>>> wrote:
>>>>> Hello,
>>>>> using setDestination(...), I chain :
>>>>> * a first identity XSL,
>>>>> * a java class that extends ProxyReceiver, and adds a test
>>>>> attribute on each element
>>>>> * a second identity XSL,
>>>>> * a Serializer that outputs to a file
>>>>> When I run this, I have no error, and the destination file is not
>>>>> written.
>>>>> When I remove the second identity XSL, destination file is written.
>>>>> As I have no error, it is difficult to understand where the problem
>>>>> is...
>>>>> The Java class I use is
>>>> https://github.com/cmarchand/gaulois-pipe/blob/master/src/test/java/fr/efl/chaine/xslt/utils/AttributeAdder.java
>>>>> and is largely inspired by net.sf.saxon.serialize.AttributeSorter
>>>>> Any help will be appreciated.
>>>>> Best regards,
>>>>> Christophe
> _______________________________________________
> 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 
Loading...