View Single Post
  #5 (permalink)  
Old September 27th, 2012, 05:04 AM
WilliamYou WilliamYou is offline
Authorized User
Points: 141, Level: 2
Points: 141, Level: 2 Points: 141, Level: 2 Points: 141, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2012
Posts: 35
Thanks: 18
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by mhkay View Post
It's a while since I did this, but I think you're trying to set up a pipe with four components:

reader -> pipeline -> filter -> serialiser

but then you do this

Code:
        pipeline.setContentHandler(serialiser) ;
	pipeline.parse(source.getSystemId()) ;
which means the pipeline talks directly to the serializer without going via the filter. I think both these two methods should be applied to the filter rather than the pipeline.

But I'm also confused because you're doing this

Code:
Source styleSource = factory.getAssociatedStylesheet(source, null, format, null) ;
and this stylesheet is never used in the pipeline (the filter is using some other stylesheet). Are you applying the XSLT that you think you are?
Hello again,

and thank you once again for your help. The reader -> pipeline -> filter -> serialiser scenario is correct but if the truth be told I don't really need a serialiser as my XMLFilters take care of generating the output which is why the last thing I do is outputFile.delete(). I am doing it this way as for the moment this is the only way I know how and was based on this book's (E.3.5) example.

I have changed the code as you suggested to :
Code:
        filter.setContentHandler(serialiser) ;
	filter.parse(source.getSystemId()) ;
And I now get an error :
Code:
XTDE0050: No value supplied for required parameter selector
This of course tells me that the stylesheet is indeed now being used, but I set (or thought I set this) parameter at about line 34 in the original code posting! So something still isn't right.

You're confusion regarding the
Code:
Source styleSource = factory.getAssociatedStylesheet(source, null, format, null) ;
is justified but the XML input file contains references to multiple stylesheets so I use styleSource's getSystemId() via my BinaryTokeniser to extract the one I want from the application's resources, hence the StreamSource style a couple of lines later.

--
William
Reply With Quote