Subject: [xsl] Xalan Java Extension questions. From: "Sudhir Malhotra" <sudhirmalhotra123@xxxxxxxxxxx> Date: Fri, 13 Apr 2001 15:51:36 -0500 |
-----------JAVA CODE snippet---------------------- // This is just sample code to show our approach
public void transformInputXml() { Date timeRangeStart;
// source has Input XML // target has Output XML // transformer uses createOutputAndGetStartDate.xsl
createOutputAndGetStartDate = new StreamSource(new File( createOutputAndGetStartDate.xsl )); TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer (createOutputAndGetStartDate); transformer.transform(source, target);
// 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
// QUESTION 3. // In case the Input XML is an error response instead // of the data requested, I need to capture the // Error code and reason per the INPUT XML 2 below. // Currently I get TransformerException. // I added the following lines to xsl // <xsl:template match="reply/source/Error"> // <xsl:message terminate="yes"/> // <!--<xsl:text><xsl:value-of select="@reason"/></xsl:text>--> // <xsl:text>Error received from source</xsl:text> // </xsl:template> // I am not able to get the @reason value back to Java context // so that I can inform the user what happened. // Neither can I get the error message I inserted within xsl:text // tag
} ------------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------------------------
Sudhir Malhotra _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] MSXML3: Getting the new n, Joel P Thornton | Thread | [xsl] Trade Marks, murali meraga |
RE: [xsl] MSXML3: Getting the new n, Joel P Thornton | Date | [xsl] How to get ' to display prope, Webster, Jon |
Month |