|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Generating HTML with DataChannel XJP
I have some HTML 4.0 embedded within an XML document, and want to
use DataChannel's XJ package to reproduce it in the result of an
XSL transformation.
It is my understanding that the default rules should work to copy
parts of the tree without a specific template - when I specify the
default rules myself, the package crashes (specifically when the
text() template is added.) Of course DCXJP is aimed at the December
1998 XSL spec, so I'm stuck with outdated XSL.
Has anyone run into / solved this problem? And no suggestions
about moving to another package please - I don't enjoy using this
package.
I enclose some sample files to demonstrate the problem
XML
===
<?xml version="1.0"?>
<!DOCTYPE documentation-html []>
<documentation-html>
<p>Here's some HTML with some <em>emphasis</em>
and a <a href=".">link</a>.</p>
</documentation-html>
===
XSL
===
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<body>
<xsl:apply-templates />
</body>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="." />
</xsl:template>
</xsl:stylesheet>
===
Java
====
import java.io.FileInputStream;
import com.datachannel.xml.om.Document;
import com.datachannel.xml.om.IXMLDOMNode;
import com.datachannel.xml.util.XMLOutputStream;
import com.datachannel.xtl.engine.XTLProcessor;
public class DCXJPTest
{
public static void main(String argv[]) throws Exception
{
if ( (argv.length != 2) ||
((argv.length >= 1) && (argv[0].equals("-help"))) )
{
System.out.println("java DCXJPTest <dataFile> <styleFile>");
System.exit(0);
}
FileInputStream xmlStream = new FileInputStream(argv[0]);
Document dataDocument = new Document();
dataDocument.loadFromInputStream(xmlStream);
xmlStream.close();
FileInputStream xslStream = new FileInputStream(argv[1]);
Document styleDocument = new Document();
styleDocument.loadFromInputStream(xslStream);
xslStream.close();
XMLOutputStream outputStream = new XMLOutputStream(System.out);
((IXMLDOMNode)dataDocument.getDocumentElement()).transformNode(
((IXMLDOMNode)styleDocument.getDocumentElement()), outputStream);
} /* void main(String[]) */
} /* class DCXJPTest */
====
--
Warren Hedley
Department of Engineering Science
Auckland University
New Zealand
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
|

Cart








