Embedding Java directly in XSLT using Extensions

Bradley Wagner <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <[email protected]>
Is it not possible to embed arbitrary Java code directly in an XSLT
stylesheet using Xalan Extensions the same way you can with JavaScript? I
was under the assumption that you could basically do the following:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet
extension-element-prefixes="date-converter" version="1.0"
xmlns:date-converter="http://www.company.com/dateConverter/1.0/"
xmlns:xalan="http://xml.apache.org/xalan" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"> <!-- Xalan component for date
conversion from CMS date format to RSS 2.0 pubDate format -->
<xalan:component prefix="date-converter"> <xalan:script lang="javaclass"
src="http://xml.apache.org/xalan/java"> package mine; public class
MyConverter { public int
convertDateJava(org.apache.xalan.extensions.ExpressionContext context, long
time) { Date date = new Date(time); return "" + date.getMonth()+1 + "/" +
date.getDay()+1 + "/" + date.getYear(); } } </xalan:script>
</xalan:component> </xsl:stylesheet>

but it's looking like you have to have some Java class or function already
on the classpath to call instead. Is this accurate? I guess this would make
more given that the Xalan is probably not compiling code at runtime. I guess
I'm just confirming at this point.

Thanks,
Bradley Wagner
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.