This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: XSLT 1.1 comments


| > The <xsl:script> element could just as well be called:
| > 
| > <xsl:associate-user-written-extension-function-implementation-with-namespace/>
| 
| I don't understand.  Do you mean msxml:script?

I mean that the <xsl:script> element associates an
implementation of user written extension functions with
a given namespace, in a language-neutral way.

Today each existing processor that supports user-written
extension functions does this namespace-to-implementation
binding in a proprietary way. Some use extension elements,
some use funky recognize-something-in-the-namespace-uri
tricks.

<xsl:script> provides a standard way of accomplishing the same
thing, and makes it much more clear that user-written extension
functions are being used in the current stylesheet.

Using the implementation I'm most familiar with, a concrete
example of this difference is the following:

Today, to use the java.util.Date class in a stylesheet
to retrieve the current date, in OracleXSLT I do 
something like this:

  <xsl:stylesheet version="1.0" xmlns:xsl="..."
    xmlns:date="http://www.oracle.com/XSL/Transform/Java/java.util.Date">
    <xsl:template match="/">
      <xsl:value-of select="date:toString(date:new())"/>
    </xsl:template>
  </xsl:stylesheet>

The fact that this is a user-written extension function and the
fact that the language is java is totally buried in the uri.

With <xsl:script> this becomes:

  <xsl:stylesheet version="1.0" xmlns:xsl="..." xmlns:date="urn:date">

    <!-- 
     | Fact that user-written extension functions are in use is 
     | much more clear, and done in a uniform way.
     +-->
    <xsl:script implements-prefix="date" 
                              src="java:java.util.Date"/>

    <xsl:template match="/">
      <xsl:value-of select="date:toString(date:new())"/>
    </xsl:template>
  </xsl:stylesheet>

______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly
http://www.oreilly.com/catalog/orxmlapp/



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]