[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Xalan Java Extension questions.
Hi:
I would highly appreciate any suggestions, or pointers to web based resources or java/xsl code samples. I have gone through Xalan-Java extensions examples. ----------INPUT XML------------- <?xml version="1.0" encoding="UTF-8"?> <reply> <source name="NYSE"> <entries grouping="instrument" numberOfTimeUnits="60" resultTZ="ET" segmentEnd="15:00:00" segmentStart="08:30:00" timeRangeEnd="20000929-15:00:00 ET" timeRangeStart="20000929-09:30:00 ET" timeUnit="minutes"> ... Lots of other stuff ... </entries> </source> </reply> ----------INPUT XML end------------------------ I would like to instantiate java Date object in my java code as follows. -----------JAVA CODE snippet---------------------- // This is just sample code to show our approach public void transformInputXml() { Date timeRangeStart;
createOutputAndGetStartDate = new StreamSource(new File( createOutputAndGetStartDate.xsl )); TransformerFactory tFactory = TransformerFactory.newInstance();
// I am able to get my target XML // I can create the timeRangeStart Date object // inside createOutputAndGetStartDate.xsl // QUESTION 1. : I do not // know how to get the Date object created in XSL context // back to Java context and so that it prints // "September 29, 2000 ... " per the next line. // I am constrained not to make timeRangeStart static. // I my case I need the transformation to go on // to plot the stock prices coming from the market, and // I need also need the Date value returned to me // in the java context, without // making another call through the transformer System.out.println ( timeRangeStart.toString() ); // QUESTION 2. : How to create a complex object in Java // context and pass it to xsl // I am able to pass a string object // transformer.setParameter("PersonName", "Joe" ); // <xsl:param name="PersonName" select="anonymous"/> // How to pass a Person object, containing all its // members?
} ------------JAVA CODE Snippet end------------- ----------INPUT XML 2------------------ <?xml version="1.0" encoding="UTF-8"?> <reply> <source name="NYSE"> <Error code="-300" reason="Connection failed" /> </source> </reply> ----------INPUT XML 2 end------------------------ Any help would be greatly appreciated. Thank you. Sudhir Malhotra _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|