Hello!
I have looked up these two questions in the archives but don't seem to find
a complete answer. If anybody could help I would be greatful.
two questions:
1) accessing java objects from xslt:
I have tried using the following code to attach a java object to my xsl
transformer:
transformer.setParameter("blop", someObject);
now I want to call the method in this function from xsl, how do I do this?
i.e. I would like to call someObject.doSomething('bla') from the xsl file.
Could someone help me out with an example! thanks...
2) passing a DOM object to xslt: (similar to above)
I am trying to access a DOM element from xslt, but it seems to be passed
through as null object when it is not!
-----java-----
javax.xml.parsers.DocumentBuilderFactory df =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
javax.xml.parsers.DocumentBuilder db = df.newDocumentBuilder();
org.w3c.dom.Document doceroo = db.newDocument();
org.w3c.dom.Element nds = doceroo.createElement("nds");
doceroo.appendChild(nds);
nds.setAttribute("bla","8.5");
transformer.setParameter("blop", doceroo);
-----java-----
---- xsl -----
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="blop" />
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="*">
<html>
<body>
|<xsl:value-of select="$blop" />|
</body>
</html>
</xsl:template>
</xsl:stylesheet>
---- xsl -----
--- result ---
<?xml version="1.0" encoding="UTF-8"?>
<html>
<body>
|[#document: null]|
</body>
</html>
--- result ---
Sean.
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list