XML/XSLT Scrapbook
Resin 3.0

Features
Installation
Configuration
Web Applications
IOC/AOP
Resources
JSP
Quercus
Servlets and Filters
Databases
Admin (JMX)
CMP
EJB
Amber
EJB 3.0
Security
XML and XSLT
XTP
JMS
Performance
Protocols
Third-party
Troubleshooting/FAQ

Introduction
JAXP
User's Guide
Reference
FAQ
Scrapbook
FAQ
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)


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