Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 731753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:03:49+00:00 2026-05-14T07:03:49+00:00

I am working with an open source version of the Saxon XSLT processor Saxon

  • 0

I am working with an open source version of the Saxon XSLT processor “Saxon 9.0.0.2J from Saxonica” and am trying to make use of the java extensibility for the first time. I am running
into an issue I suspect may be a limitation on the open source version, but wanted to check first whether there might be something I am just missing here.

From the snippet below, my result is that the final value of $c1 does not change as a result of the call to greg:setTime() – i.e. the $c1 variable within Saxon appears to be unhooked from the underlying Java object and there is no apparent way to access the object as updated by the setTime() call.

NOTE that all code in the snippet is tested and working otherwise – i.e. $c1 is properly instantiated by the getInstance() call, $startdate is of the proper format and $d1 is properly instantiated.

Thoughts?

<xsl:transform
       .....
       xmlns:sql="java:java.sql.Date"
       xmlns:greg="java:java.util.GregorianCalendar"
       .....
>
....
<xsl:element name="JobExpireDate">
      <xsl:variable name="c1" select="greg:getInstance()" />
      <xsl:variable name="d1" select="sql:valueOf($startdate)" />
      <xsl:variable name="void" select="greg:setTime($c1,$d1)" />
      <xsl:value-of select="$c1" />
</xsl:element>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:03:50+00:00Added an answer on May 14, 2026 at 7:03 am

    I just tried with saxonb9-0-0-8j.

    Calls to void functions are sometimes ignored, as demonstrated by the following.

    The input file:

    <root>
    <date1>2009-01-02</date1>
    <date2>2009-01-02</date2>
    </root>
    

    The transform:

     <xsl:transform
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
           xmlns:sql="java:java.sql.Date"
           xmlns:greg="java:java.util.GregorianCalendar"
     version="2.0">
    
    <xsl:template match="*">
      <xsl:copy>
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates/>
      </xsl:copy>
    </xsl:template>
    
    <xsl:template match="root/date1/text()">
          <xsl:variable name="c1" select="greg:getInstance()" />
          <xsl:variable name="d1" select="sql:valueOf(.)" />
          <xsl:variable name="void" select="greg:setTime($c1,$d1)" />
          <xsl:value-of select="greg:getTime($c1)" />
    </xsl:template>
    
    <xsl:template match="root/date2/text()">
          <xsl:variable name="c1" select="greg:getInstance()" />
          <xsl:variable name="d1" select="sql:valueOf(.)" />
          <xsl:value-of select="greg:setTime($c1,$d1)" />
          <xsl:value-of select="greg:getTime($c1)" />
    </xsl:template>
    
    </xsl:transform>
    

    The result:

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <date1>2010-04-14T08:23:25.341Z</date1>
    <date2>2009-01-01T23:00:00Z</date2>
    </root>
    

    So it seems that setTime() is not called for date1, but for date2.

    Saxon has a nice explain feature that displayes the parsed transformation in a readable format:

    ...
    <templateRule match="root/date2/text()" precedence="0" priority="0.5" line="21"
                  module="file:/C:/devtools/saxonb9-0-0-8j/template.xsl">
      <let variable="c1" as="java:java.util.Calendar?">
        <be>
          <functionCall name="greg:getInstance"/>
        </be>
        <return>
          <sequence>
            <valueOf>
              <simpleContentConstructor>
                <functionCall name="greg:setTime">
                  <variableReference name="c1"/>
                  <functionCall name="sql:valueOf">
                    <dot/>
                  </functionCall>
                </functionCall>
                <literal value=" " type="xs:string"/>
              </simpleContentConstructor>
            </valueOf>
            <valueOf>
              <simpleContentConstructor>
                <functionCall name="greg:getTime">
                  <variableReference name="c1"/>
                </functionCall>
                <literal value=" " type="xs:string"/>
              </simpleContentConstructor>
            </valueOf>
          </sequence>
        </return>
      </let>
    </templateRule>
    <templateRule match="root/date1/text()" precedence="0" priority="0.5" line="14"
                  module="file:/C:/devtools/saxonb9-0-0-8j/template.xsl">
      <valueOf>
        <simpleContentConstructor>
          <functionCall name="greg:getTime">
            <functionCall name="greg:getInstance"/>
          </functionCall>
          <literal value=" " type="xs:string"/>
        </simpleContentConstructor>
      </valueOf>
    </templateRule>
    ...
    

    As you see, for date1, the call to setTime() is ignored, but is there for date2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on my own open-source project. I've recently released the first workable version
I am working on an open source project which can use a number of
I'm working on a little game called freegemas , it's an open source version
I am working on the contacts app from android open source project. My android
I am working on an iPhone project and want to use an open source
When working on multiple (open source) projects, multiple version controll systems start to be
I'm working with an open-source .NET app that takes a long time to startup
I'm working on a backend for an open source Python ORM. The library includes
I'm working on customizing a couple of open source projects in ways that are
I'm working on a database with mysql 5.0 for an open source project it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.