From cocoon-dev-return-15792-apmail-xml-cocoon-dev-archive=xml.apache.org@xml.apache.org Wed Jul 25 14:48:59 2001 Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 44759 invoked by uid 500); 25 Jul 2001 14:48:59 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Delivered-To: moderator for cocoon-dev@xml.apache.org Received: (qmail 86213 invoked from network); 25 Jul 2001 08:45:40 -0000 From: =?iso-8859-1?Q?J=F6rn_Heid?= To: "Cocoon-Users" , "Cocoon-Dev" Subject: [C2b2] Workaround for XInclude-Bug Date: Wed, 25 Jul 2001 10:42:53 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N For those who do have problems with the XInclude-Transformer, here's a workaround (not a patch!): 1. Copy src/org/apache/transformation/XIncludeTransformer.java 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 = (URLFactory)this.manager.lookup(URLFactory.ROLE); 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 nessesary): /** * Recycle the component */ public void recycle() { super.recycle(); this.current_xmlbase_uri = null; this.base_xmlbase_uri = null; this.xmlbase_element_name_stack.clear(); this.xmlbase_element_uri_stack.clear(); 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: 6. The last thing is that each time you are using the transformer you must set the src-Parameter: 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. JOERN_HEID --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org