Databases Scrapbook
Resin

Change Log
Documentation

Orientation
Features
Installation
Configuration
Web Applications
JSP
Servlets and Filters
Databases
Admin (JMX)
Security
XML and XSLT
XTP
Resources (JNDI)
Performance
Protocols
Third-party
Troubleshooting

Introduction
User's Guide
Reference
Scrapbook
XPath Functions
XML and XSLT
XTP

A repository of notes and comments that will eventually make their way into the documentation. Please treat the information here with caution, it has often not been verified.

  1. XSLT
    1. URIResolver

XSLT

URIResolver

With an URIResolver is that you can create a catalog or map configuration that matchs an ID with the actual URI. So you use the id xml:hoo in you document("xml:hoo") and you set the URIResolver to return the resource id'd in the catalog. You can also ensure that non-inhouse developed XSL are coming from a place that you specify.

<catalog>
  <file id="xml:hoo" uri="http://hoo.com/boo/hoo.xml"/>
</catalog>
you set the URIResolver like:

TransformerFactory factory = TransformerFactory.newInstance();
factory.setURIResolver(new MyURIResolver(args));
here is a simple URIResolver:

import java.io.*;
import java.util.*;

import javax.xml.transform.*;
import javax.xml.transform.stream.*;

class MyURIResolver implements URIResolver {
   private MyObj obj;

   public MyURIResolver(MyObj obj) {
      this.obj = obj;
   }

   public Source resolve(String href,String base) {
System.out.println("href: " + href);
System.out.println("base: " + base);
    if (href.equals("xml:hoo")) {
      return new StreamSource((File)this.obj.getResolvedFile(href));
    }
    return null;
  }
}

(Thanks to Robert Koberg)


XPath Functions
XML and XSLT
XTP
Copyright © 1998-2003 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.