GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes Incrementing 1 Day in XSLT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Incrementing 1 Day in XSLT" Watch "Incrementing 1 Day in XSLT" New topic
Author

Incrementing 1 Day in XSLT

Mahdad Zarafshan
Greenhorn

Joined: Jan 15, 2004
Posts: 12
Hi,

I'd like to increment the value of a date/time variable by a day in XSLT. I can create a new template and do it in the new template. I'm not sure if there are built-in extensions such as exslt or xalan that provide such a functionality.

Some basic questions in XSLT:
1 - What's the difference between a .xslt and a .xsl file? Identical? If they're identical, why use 2 names and not a single name?

2 - Technically, is a xslt or a xsl file runnable by itself without having an xml data file?

3 - When running a xslt or xsl file, how does the XSLT processor which xml file to map to this xslt file? Or vice versa, when an xml file does not directly refer to a xslt file as a style sheet, how does a processor know how to pick a xslt to display the xml data, and based on what criteria?

4 - I tried using date.zip from exslt.org web site but it seems that either their code is broken, or my xml editor (Altova's xmlpy) doesn't support it becuase I'm getting "Unexpected child" error when trying to include date.xsl from exslt.org. Any idea about that?

Thanks.

Mahdad
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

1. Extensions only mean something to the Windows operating system (and perhaps some others that I don't know anything about). You can name an XSLT file anything you like and software that processes it won't care about its extension. And why .xsl and .xslt? That dates back to when filenames could only be 8 characters and extensions only 3 characters.

2. It's possible to write an XSLT that doesn't require an input file, but uses the document() function to get all of its input.

3. How does an XSLT processor know where to find the XML to be transformed? You tell it where. Exactly how you tell it depends on the processor (read its documentation), and on whether you run it from the command line or from within a Java program or from some framework.

4. No idea.
Arjunkumar Shastry
Ranch Hand

Joined: Feb 28, 2005
Posts: 986
Hi Paul,just off the topic,are you the same guy on javasoft forum who posts by name DrClap?


Namma Suvarna Karnataka
Mahdad Zarafshan
Greenhorn

Joined: Jan 15, 2004
Posts: 12
Hi Paul,

Thanks.

1 - Where's document() getting its input info. from?
2 - Any idea where to get some reliable extensions for powerful date/time manipulation? Does xalan provide this? I tried exslt but it does not seem to be that reliable.

Mahdad
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

It's actually document(xxx), where xxx is a URI that tells the transformer where to get its input. At least in its simplest form it is.

As for EXSLT, since you don't know much about XSLT it's likely you aren't using it right. Anyway it's a community initiative so why don't you just ask them?
 
GeeCON Prague 2014
 
subject: Incrementing 1 Day in XSLT