|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
I'm using the xalan JAXP transformer to transform a very simple xml file with a very simple xsl file. My goal is to create a snippet of HTML.
When I transform the document using XMLSpy I get html back. When I transform the same two files programmatically, my html is completely ignored and I get back text. How frustrating is this, eh?!?!? Any ideas? --k Here's the transform Java code: public xmlTransform(String urlXML, String urlXSL) throws TransformerException, TransformerConfigurationException, FileNotFoundException, IOException { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource( urlXSL )); // Use a ByteArrayOutputStream so that I can turn it into String outStream = new ByteArrayOutputStream(); transformer.transform(new StreamSource( urlXML ), new StreamResult( outStream )); } Here's the xsl: <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl utput method="html" indent="no" /><xsl utput omit-xml-declaration="yes" /><xsl:strip-space elements="*" /> <xsl:template match="commonopinion"> <xsl:apply-templates select="question" /> </xsl:template> <xsl:template match="question"> <p> Name: <xsl:value-of select="name"/><br/> ID: <xsl:value-of select="id"/><br/> Description: <xsl:value-of select="description"/><br/> </p> </xsl:template> </xsl:stylesheet> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSL ignores method="html", generates text instead |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|