Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Incrementing 1 Day in XSLT

 
Mahdad Zarafshan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20768
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 986
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,just off the topic,are you the same guy on javasoft forum who posts by name DrClap?
 
Mahdad Zarafshan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20768
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic