[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: calling external java functions via XSLT

  • From: "Steve Muench" <smuench@u...>
  • To: "Donald Lingle" <ulingdg@l...>
  • Date: Tue, 25 Apr 2000 09:09:42 -0700

using java functions in xsl
| Currently the ability to call java external functions within XSLT is not
| a part of the initial XSLT spec.  Does anyone out there wish it was 
| or realize a need for this type of thing.


XSLT 1.0 defines both an extension function and extension element
mechanism. Many vendors' XSLT 1.0 implementations support this feature
in one or more programming languages, Java included. 

The XSLT 1.0 specification does not specify the *implementation* details
for implementing the extension functions -- or put any limit on what
kind of languages can be used to write extensions -- but you'll find a great
similarity in the way that engines like XT, Saxon, LotusXSL/Xalan, OracleXSL
do their java extension functions (mostly an XML namespace is the difference).

Here's a simple example that shows creating a new Date using 
java.util.Date using the extension namespace for java extension
functions that the Oracle XSLT Processor recognizes. For other processors,
it should be similar.

<!-- Enrollment.xsl -->
<xsl:stylesheet version="1.0" exclude-result-prefixes="date"
  <xsl:output indent="yes" doctype-system="Enrollment.dtd"/>
  <xsl:param name="School"/>
  <xsl:template match="/">
    <enrollment institution-id="{$School}" date = "{date:toString(date:new())}">
      <xsl:for-each select="courses/row">
        <class id = "{course}">
          <xsl:for-each select="students/students_row">
              <first-name><xsl:value-of select="name"/></first-name>
              <age><xsl:value-of select="age"/></age>

Steve Muench, Lead XML Evangelist & Consulting Product Manager
Business Components for Java & XSQL Servlet Development Teams
Oracle Rep to the W3C XSL Working Group

This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.