View Single Post
  #6 (permalink)  
Old September 28th, 2012, 05:19 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

OK, I've reviewed my code and I've now changed it so that :
XMLFilter filter = saxFactory.newXMLFilter(style) ;
filter.setParent(reader) ;
pipeline.setParent(filter) ;
as I want my filter to be a PostFilter and the last in the pipeline. I then use :
pipeline.setContentHandler(serialiser) ;
pipeline.parse(source.getSystemId()) ;
to do that actual parsing. However, I still get told that I have not passed the expected parameter(s) to the stylesheet.

Now when I view both my code and the code from the example (E.3.5) I think I can see why. To me the Transformer is never actually used, either in my code or the example's.

If I comment out the code
Transformer t = serialiser.getTransformer() ;			t.setOutputProperty(OutputKeys.METHOD, "xml") ;
t.setOutputProperty(OutputKeys.INDENT, "yes") ;
t.setParameter("selector", list) ;
I end up with the same error regarding the lack of parameter values, proving to me at least that the Transformer is redundant.

So how do I pass values to the stylesheet prior to parsing?