[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: getting java file parameters and tunnelling

Subject: RE: getting java file parameters and tunnelling
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 11 Aug 2005 23:14:38 +0100
java file
Concerning your first query: the JAXP specification leaves it
implementation-defined exactly what kinds of Java object you can supply to
the setParameter() method. Some products might accept a File object, but I'd
be a little surprised if they did. Saxon will accept any Source object, so
you could do

trans.setParameter("TestFileNm", new StreamSource(new
File("inputFile.xml")))

but this might not work with other products. The most portable way to supply
a document as a parameter is probably to parse the XML file into a DOM and
pass the DOM Document node - unfortunately this might not be the most
efficient approach, since with many XSLT processors their own native tree
implementation is much more efficient than the DOM.

Michael Kay
http://www.saxonica.com/ 


> -----Original Message-----
> From: Rahil [mailto:qamar_rahil@xxxxxxxxxxx] 
> Sent: 09 August 2005 12:49
> To: XSL List
> Subject:  getting java file parameters and tunnelling
> 
> Hi
> 
> I have two queries.
> 
> (1) I am passing a filename as a parameter to my XSL file from a java 
> file. The java file code snippet looks like this:
> --------------
> TransformerFactory transFact = TransformerFactory.newInstance(  );
>  Transformer trans = transFact.newTransformer(XsltSource);
>  trans.setParameter("TestFileNm", new File("inputFile.xml"));
>  trans.transform(XmlSource, Result);
> 
> I receive this parameter in this form in my XSL file
> 
> <xsl:param name="fileNm" select="TestFileNm"/> <! -- Not working-->
> ---------------
> and then access $fileNm as document($fileNm) etc ...
> 
> However this param doesnt seem to get the file and hence no 
> processing 
> happens. Could someone locate the problem please ?
> 
> (2) I want to check whether my tunnelling code is correct as I havent 
> ever used it before and am not getting any results at the 
> moment which 
> might be because of (1).
> 
> I have a first.xsl which receives a parameter from my java 
> file as such:
> --------------
> <xsl:output method="html" saxon:next-in-chain="second.xsl"/>
> <xsl:param name="fileNm" select="TestFileNm" tunnel="yes"/>
> 
> second.xsl then receives this parameter value through
> <xsl:param name="fileNm" tunnel="yes"/>
> --------------
> Is this correct ?
> 
> Thank you to all for helping out.
> Rahil

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.