Hi all,
I need to re-factor some code that uses a transformation where I pass a
snippet of xml to a xsl stylesheet.
The code is in Apache Forrest especially in the dispatcher. I have a
configuration file (structurer) that can provide custom xml for a
contract as properties.
<forrest:contract name="siteinfo-meta">
<forrest:property name="custom">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
</forrest:property>
</forrest:contract>
A contract is a simple xsl stylesheet that picks up the properties via a
xsl:param.
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="custom" />
...
<xsl:copy-of select="$custom/*"/>
...
</xsl:stylesheet>
In the java code I am doing right now something like:
DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
transformer.setParameter("custom",
builder.parse("xmlOfCustomProperty"));
I came up with this code since I did not found any other way to pass xml
as parameter to the transformation.
It seems that if the Object is not of type org.w3c.dom.Document I cannot
treat it as xml directly. I tried with a SAX source but that did not
work.
Is there a way to pass xml as parameter to a xsl stylesheet without
using DOM?
TIA for any information.
salu2
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions