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

Reply via email to