cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörn Heid <>
Subject [C2b2] Workaround for XInclude-Bug
Date Wed, 25 Jul 2001 08:42:53 GMT
For those who do have problems with the XInclude-Transformer, here's a
workaround (not a patch!):

1. Copy src/org/apache/transformation/ to a
directory of your choice for compiling it.

2. Replace the setup method with this one:

   public void setup(SourceResolver resolver, Map objectModel,
                      String source, Parameters parameters)
            throws ProcessingException, SAXException, IOException {
            if (manager != null && current_xmlbase_uri == null) {
               try {
                   source = parameters.getParameter("src", "");
                   source = source.substring (0, source.lastIndexOf ('/'));
                   this.urlFactory =
                   base_xmlbase_uri = urlFactory.getURL(source);
                   this.current_xmlbase_uri = base_xmlbase_uri;
                   } catch (Exception e) {
                           getLogger().debug("XincludeTransformer", e);
                           throw new ProcessingException(e.getMessage(), e);

3. Add the following lines to the source-File (don't know if it's
     * Recycle the component
    public void recycle() {
        this.current_xmlbase_uri = null;
        this.base_xmlbase_uri = null;
        this.last_xmlbase_element_name = "";

4. Change the packagename and compile it.

5. In the sitemap change the definition of the XIncludeTransformer regarding
your package:
			<map:transformer name="xinclude"

6. The last thing is that each time you are using the transformer you must
set the src-Parameter:

			<map:match pattern="**.xml">
				<map:generate src="{1}.xml"/>
				<map:transform type="xinclude">
					<map:parameter name="src" value="{1}.xml"/>
				<map:transform src="xsl/page.xsl"/>

For the developers: The problem is that the setDocumentLocator method is not
called enough times. If there are two instances of the transformer the
method is only called on one transformer.
When stopping the engine (Resin), then the method isn't called one time! -
but the setup-method. So I used it for this workaround.


Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message