|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Subject: RE: XML fragment as a param ?
recap: I'm trying to pass XML through to a param in my stylesheet. I'm using
Xalan.
When I do this :- transformer.setParameter(param.name, param.value); where param.name and param.value are both Strings and contain - "inboundXML" and "<Numbers><Odds><One>1</One>... " and when the stylesheet looks like this :- ...
<xsl:param name="inboundXML" select="/"/>
<xsl:template match="/">
<rootContainer>
<xsl:copy-of select="$inboundXML"/>
</rootContainer>
</xsl:template>
...I get this (almost correct but no cigar :-) :- <rootContainer>
<Numbers><:Odds><One>1.....
</rootContainer>Previously Michael commented :- Michael> Xalan, like Saxon, uses the setParameter() method on the JAXP javax.xml.transform.Transformer class. Michael> However, the JAXP API doesn't actually say what kind of object you can Michael> supply as the value. Most products will allow you to supply a DOM node (they Michael> may restrict which DOM implementations you are allowed to use). Saxon allows Michael> you to supply any JAXP Source object, so if you supply a StreamSource Michael> containing raw XML, the XML will be parsed and the stylesheet will see the Michael> resulting document node as the parameter value. That's interesting I thought so I tried doing this (admittedly I'm not using Saxon (sorry Michael) so no guarantees) :- transformer.setParameter(param.name, new StreamSource(new StringReader(param.value))); but unfortunately all that gave me was :- <rootContainer>javax.xml.transform.stream.StreamSource@4c6ca8b6</rootContainer> I have tried using the exslt:node-set function, but I'm not sure I got it correct. I would welcome any suggestions and perhaps a small example ? Cheers Fraser.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








