I have found it terribly inconvenient to access fields in Java object with the javaclass extensions in Xalan. java.util.Calendar relies heavily on fields and so is very hard to use. Can anyone show me a better way to do this with the Calendar class and its many fields? Thanks!

<xsl:variable name="calendar" select="java:java.util.Calendar.getInstance()"/>
<xsl:variable name="calendar-class" select="java:getClass($calendar)"/>
<xsl:variable name="date-field" select="java:getField($calendar-class, 'DATE')"/>
<xsl:variable name="date-field-value" select="java:getInt($date-field, $date-field)"/>
<xsl:variable name="month-field" select="java:getField($calendar-class, 'MONTH')"/>
<xsl:variable name="month-field-value" select="java:getInt($month-field, $month-field)"/>
<xsl:variable name="year-field" select="java:getField($calendar-class, 'YEAR')"/>
<xsl:variable name="year-field-value" select="java:getInt($year-field, $year-field)"/>
<xsl:value-of select="java:get($calendar, $year-field-value)"/>
<xsl:value-of select="java:get($calendar, $month-field-value)"/>
<xsl:value-of select="java:get($calendar, $date-field-value)"/>


Reply via email to