XML/XSLT Scrapbook
Resin 3.1

Documentation
Examples
Changes

Overview
Installation
Configuration
Quercus
SOA/IoC
JSP
Servlets and Filters
Admin (JMX)
EJB
Amber
Security
Performance
Hessian
XML and XSLT
Third-party
Troubleshooting/FAQ

Introduction
JAXP
XML Path Language (XPath)
XSLT Filter
XSLT
XPath Functions
FAQ
Scrapbook
FAQ
XML and XSLT
Third-party

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.

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
Third-party
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin ® is a registered trademark, and Quercustm, Ambertm, and Hessiantm are trademarks of Caucho Technology.