Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] XSLTransform constructors are flawed

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] XSLTransform constructors are flawed
  • Date: Wed, 1 Sep 2004 17:02:37 -0400

There are currently five overloaded constructors in XSLTransform:

public XSLTransform(Document stylesheet)
public XSLTransform(File stylesheet)
public XSLTransform(String stylesheetURL)
public XSLTransform(InputStream stylesheet)
public XSLTransform(Reader stylesheet)

The last two are seriously flawed. :-(

The specific problem is that they do not provide base URLs for the stylesheet, thereby preventing the resolution of relative URLs found in xsl:import and xsl:include elements and document() functions.

There are several options open here:

1. Add new InputStream and reader constructors that take a second base URL argument
2. Deprecate the existing InputStream and reader constructors and them remove them.
3. Deprecate all but the first constructor and then remove them.

I prefer the third option which would leave this class with just a single constructor. The other four constructors are minor conveniences at best. It's a simple matter of

XSLTransform transform = new XSLTransform(builder.build(source));

instead of

XSLTransform transform = new XSLTransform(source);

However, since we're now in beta I do want to ask to what extent anyone's code depends on these four constructors? If anyone screams too loudly I'll consider retaining them, especially the File and String constructors since those aren't fundamentally flawed. At a minimum all will be deprecated for at least one beta before being removed. Thought? Comments?
--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA




Archive powered by MHonArc 2.6.24.

Top of Page