RE: [xsl] design question on function namespaces

Subject: RE: [xsl] design question on function namespaces
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 3 May 2005 13:58:03 +0100
> I think based on this, I'm going to try where possible to have logic 
> defined in functions, and in xpath (2.0) rather than pure XSLT.
> 
> One design question: Mike Kay in his book on XSLT 2.0 advocates 
> function namespaces based on the namespace of the data they work on.
> 

The thinking here is that it's often useful to create a library of reusable
functions that compute derived data from your source document: for example,
"does this chapter have any footnotes" or "how many columns are there in
this table" or "is this employee in the pension scheme" or "get all the
products that this customer has bought". You should think of these as
methods associated with the element in question (even though there's no
encapsulation or inheritance), and recognize the link between code and data
by matching up the namespace.

By contrast, I tend to give local functions that are unique to one
particular module a namespace that ties them to that module (again, there's
not really such a thing as a local/private function in XSLT, but you can use
namespaces to pretend).

Michael Kay
http://www.saxonica.com/

Current Thread