Re: newbee question

James Fuller <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Organization Webcomposite
Message-ID <[email protected]>
Viresh Jain wrote:

>I want to create some extension similar to date extension.  I looked
>at the code for date extension but i could not figure our how it
>works.  It uses 'function-available("date:date-time")'and i could not
>find this particulat function anywhere in the imported files.
>
>  
>
Hello Viresh,

yes it can be a little confusing,

first off EXSLT defines functions....using them depends upon if an
implementation has been created for it, be it in pure XSLT 1.0,
javascript, msxsl, or built directly into XSLT processor.

to address your specific question;

- date:date-time has a few implementation listed on the web page

    * SAXON from Michael Kay
      <http://users.iclway.co.uk/mhkay/saxon/index.html> (version 6.4.2)
    * Xalan-J from Apache <http://xml.apache.org/xalan-j> (version 2.4.D1)
    * 4XSLT, from 4Suite. <http://4Suite.org> (version 0.12.0a3)
    * libxslt from Daniel Veillard et al. <http://xmlsoft.org/XSLT/>
      (version 1.0.19)

Implementations of |date:date-time| are available in the following
languages:

    * Javascript <http://www.exslt.org/date/functions/date-time/date.js>
      (by Chris Bayes <mailto:[email protected]>)
    * Msxsl
      <http://www.exslt.org/date/functions/date-time/date.msxsl.xsl> (by
      Chris Bayes <mailto:[email protected]>)
    *

as u see there is *no* pure XSLT implementation.....u either use the
namespace and function name in an XSLT processor that supports it(like
SAXON or XALAN) or utilise the script versions (javascript or msxsl).

if u want to develop your own extensions to XSLT you could;

- use a named template (as EXSLT does with pure XSLT 1.0 solutions)
- if u have the luxery of using XSLT 2.0, you can define functions
- 'escape' to some external language which will require XSLT processor
specific approach ( check out extensibility area of SAXON doc
http://www.saxonica.com/documentation/documentation.html  for a good
example)

here is a bit more info http://www.dpawson.co.uk/xsl/sect5/index.html

good luck, Jim Fuller
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.