I need to use the Java extensions (i.e using the abbreviated format since
I'm using Java) to handle some XML tags that need dynamic data.  I read
through the documentation for the Extensions but I had a question when
trying to implement something simple.

Could someone show me an example (or point me to one) that uses the
Calendar object, for example, directly in the XSL document (not like the
example on the extension page that has a class that uses it).  A simple
example would be like the following:

<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   version="1.0"
   xmlns:java="http://xml.apache.org/xslt/java";
   exclude-result-prefixes="java"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="Foo">
  <xsl:variable name="calendar" select="java:java.util.Calendar.getInstance
()"/>
  <xsl:variable name="year" select="java:get($calendar,
java.util.Calendar.YEAR)"/>
  <YEAR><xsl:value-of select="$year"/></YEAR>
</xsl:template>
</xsl:stylesheet>

Basically what I'm going for is:

<YEAR>2002</YEAR>

Thanks,

- Brent

Reply via email to