Ed,
 Your  setParameter() need to be made before "the" transformation starts,
effectively sets a global xsl:param in your stylesheet.  However once the
transformation has started you can't change the value of global stylesheet
variables in the middle of a transformation. You are going to need multiple
transformations and do the setParameter() on each one before the
transformation starts. But you should be able to concatenate your output by
reusing the output Writer or OutputStream from one transformation to the
next.

How about this. You have created the java.io.Writer or a
java.io.OutputStream. You can use the org.apache.xml.serializer.Serializer
interface to set either your Writer or your OutputStream.  Run each of your
documents through your stream with a startDocument and endDocument. For the
first document let it write out the XML header. For subsequent documents
you can call the reset() method on the serializer, or get a new Serializer,
but you should be able to reuse that serializer (you might have to
setWriter() with the same writer ...). Also for subsequent transformations
you need to set the property on the serializer to omit the xml header:
   java.util.Properties p = new Properties();
   p.setProperty("omit-xml-header", "yes");
   Serializer.setOutputFormat(p);

For each transformation leading into this serializer you should be able to
setParameter().

----------
Brian Minchau
XSLT Development, IBM Toronto
e-mail:        [EMAIL PROTECTED]



                                                                           
             "Edward L. Knoll"                                             
             <[EMAIL PROTECTED]                                             
             dex.com>                                                   To 
                                       [EMAIL PROTECTED]            
             10/20/2004 08:00                                           cc 
             PM                                                            
                                                                   Subject 
                                       Problem with                        
             Please respond to         Transformer.setParameter() in SAX   
                 xalan-dev             chain.                              
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




I have chain of Sax handlers which is effectively a XMLReader chained to
SAXTransformer chained to a custom ContentHandler chained to a
Serializer.   I am actually parsing multiple XML input streams to
generate a single output XML stream.   The custom Content Handler
suppresses all but the first startDocument() event and the last
endDocument() event to keep the Serializer which is generating the
single XML output from getting upset.

This is the net chain; my actually chain contains some custom "tee"
ContentHandlers and additional flows of SAX events, but I don't believe
those to be germane to my problem.

I need to change a parameter with the SAXTransformer for each file
processed.  This parameter is used to generate an output element for
each file processed. I can do a setParameter() followed by a
getParameter() and see that the parameter is changed in the Transformer.
   This is done for each file before doing a XMLReader.parse().

My problem is that the elements in the output XML which represent this
changing parameter only have the last value this parameter was set to.
I've tried doing a Transformer.clearParameters() between
XMLReader.parse() actions, but that appears to have no affect.

I would think that each XMLReader.parse() execution and so each XSL
Transformation would be independent of each other.  I don't see how
anything other than the value of this changing parameter can be
propagating through the custom ContentHandler given the signatures of
the ContentHandler methods.

--
Edward L. Knoll   Phone (FedEx)     : (719)484-2717
                   e-mail (FedEx)    : [EMAIL PROTECTED]
                   e-mail (personal) : [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to