Re: [xsl] xbind:module == xsl:script + an essential layer of indirection

Subject: Re: [xsl] xbind:module == xsl:script + an essential layer of indirection
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sat, 3 Mar 2001 08:05:58 +0000
Hi Clark,

>> The only difference is that with the current <xsl:script>
>> proposal, if you list three languages for the same
>> namespace uri, then you save a little typing by doing:
>> 
>> <xsl:stylesheet xmlns:date="http://datestuff.com/xslt/extensions";>
>>    <xsl:script implements-prefix="date" language="lang:yyyy"
>>                src="http://datestuff.com/xslt/extension/impl/dates.xyz"/>
>>                src="http://datestuff.com/xslt/extension/impl/dates.xyz"/>
>> 
>> whereas with your proposal, you repeat the namespace uri
>> each time instead of using its shortcut/prefix name:
>> 
>> <xsl:stylesheet> 
>>    <xsl:script implements="http://datestuff.com/xslt/extensions"; 
>>                language="lang:yyyy"
>>                src="http://datestuff.com/xslt/extension/impl/dates.xyz"/>
>
> First, this syntax makes a big difference, it is not merely syntax
> sugar. With implements="a-unique-uri" I can now put all of my
> scripts in a module and share this module across the organization.
> With implements-prefix="prefix", I have to coordinate prefixes
> across my enterprise in order to have a central set of scripts?
> Yuck. Talk about a maintance nightmare.

Woah, now you've completely lost me.

Namespace prefixes are completely local to a document.  The namespace
URI http://datestuff.com/xslt/extensions might be associated with the
prefix 'date' in one document or with the prefix 'd' in another
document or the prefix 'xsltdates' in another document, whatever you
want.  Namespace prefixes are *never* mandated across an entire
organisation.  What gave you the impression that this one would be?

Perhaps it was the situation where the scripts are in a separate,
imported stylesheet?  Namespace resolution is local to a particular
entity, so if just because you have the prefix 'date' in your script
module stylesheet doesn't mean that you have to use it in the
stylesheet importing it.  The XSLT processor uses the local mapping.
So I could have:

--- mymodule.xsl ---
<xsl:stylesheet xmlns:date="http://datestuff.com/xslt/extensions";>
   <xsl:script implements-prefix="date" language="perl"
               src="http://datestuff.com/xslt/extension/impl/dates.pl"/>
   <xsl:script implements-prefix="date" language="javascript"
               src="http://datestuff.com/xslt/extension/impl/dates.js"/>
</xsl:stylesheet>
---

and then have:

--- mystylesheet.xsl ---
<xsl:stylesheet xmlns:d="http://datestuff.com/xslt/extensions";>
   ...
   <xsl:value-of select="d:today()" />
   ...
</xsl:stylesheet>
---

So, as Steve said, the above are *completely* identical.  The only
difference is the amount of typing that you have to do to associate a
piece of code with a particular namespace.

And after using XML Schema for a little while, trust me, you'll long
for XSLT where prefixes are automatically resolved according to the
local prefix-URI mappings rather than having to type out URLs all day
long :)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread