forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: rev 36271 - forrest/trunk/src/java/org/apache/cocoon/transformation
Date Thu, 12 Aug 2004 05:07:59 GMT
Author: crossley
Date: Wed Aug 11 22:07:59 2004
New Revision: 36271

Modified:
   forrest/trunk/src/java/org/apache/cocoon/transformation/IdGeneratorTransformer.java
Log:
Test if an id attribute exists first, rather than prepare the default id,
then test if it already exists.
This enables Saxon to be used for documents that do have section id attributes.
(However it still fails on other documents, due to Issue: FOR-256)


Modified: forrest/trunk/src/java/org/apache/cocoon/transformation/IdGeneratorTransformer.java
==============================================================================
--- forrest/trunk/src/java/org/apache/cocoon/transformation/IdGeneratorTransformer.java	(original)
+++ forrest/trunk/src/java/org/apache/cocoon/transformation/IdGeneratorTransformer.java	Wed
Aug 11 22:07:59 2004
@@ -161,17 +161,17 @@
         getLogger().debug("## .. got "+sects.getLength()+" sections");
         for (int i=0; i<sects.getLength(); i++) {
             Element sect = (Element)sects.item(i);
-            sect.normalize();
-            getLogger().debug("## Using id XPath "+idXPath);
-            String id = null;
-            try {
-              id = processor.evaluateAsString(sect, idXPath);
-              id.trim();
-            } catch (Exception e) {
-                throw new SAXException("'id' XPath expression '"+idXPath+"' does not return
a text node: "+e, e);
-            }
-            getLogger().info("## Got id "+id);
             if (!sect.hasAttribute(this.idAttr)) {
+                sect.normalize();
+                getLogger().debug("## Using id XPath "+idXPath);
+                String id = null;
+                try {
+                  id = processor.evaluateAsString(sect, idXPath);
+                  id.trim();
+                } catch (Exception e) {
+                    throw new SAXException("'id' XPath expression '"+idXPath+"' does not
return a text node: "+e, e);
+                }
+                getLogger().info("## Got id "+id);
                 //FIXME: + produces an error on document schema
                 String newId = URLEncoder.encode(id);
                 newId = avoidConflicts(doc, sect, this.idAttr, newId);

Mime
View raw message