Return-Path: Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 58519 invoked by uid 500); 17 Aug 2003 21:03:31 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 58508 invoked by uid 500); 17 Aug 2003 21:03:30 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 58505 invoked from network); 17 Aug 2003 21:03:30 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 17 Aug 2003 21:03:30 -0000 Received: (qmail 12816 invoked by uid 1318); 17 Aug 2003 21:03:42 -0000 Date: 17 Aug 2003 21:03:42 -0000 Message-ID: <20030817210342.12815.qmail@minotaur.apache.org> From: sylvain@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/blocks/woody/samples/xsl/html woody-default.xsl X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N sylvain 2003/08/17 14:03:42 Modified: src/blocks/woody/java/org/apache/cocoon/woody/transformation WidgetReplacingPipe.java src/blocks/woody/samples/xsl/html woody-default.xsl Log: Prevent the production of if it's already present in a . This allows to pass styling information as attributes of Revision Changes Path 1.9 +17 -3 cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/transformation/WidgetReplacingPipe.java Index: WidgetReplacingPipe.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/transformation/WidgetReplacingPipe.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- WidgetReplacingPipe.java 16 Aug 2003 20:41:04 -0000 1.8 +++ WidgetReplacingPipe.java 17 Aug 2003 21:03:42 -0000 1.9 @@ -108,6 +108,9 @@ protected WoodyTemplateTransformer.InsertStylingContentHandler stylingHandler = new WoodyTemplateTransformer.InsertStylingContentHandler(); protected WoodyTemplateTransformer pipeContext; + + /** Have we encountered a element in a widget ? */ + protected boolean gotStylingElement = false; public void init(Widget contextWidget, WoodyTemplateTransformer pipeContext) { this.contextWidget = contextWidget; @@ -124,6 +127,7 @@ checkContextWidgetAvailable(qName); inWidgetElement = true; widgetElementNesting = elementNestingCounter; + gotStylingElement = false; xmlCompiler.recycle(); // retrieve widget here, but its XML will only be streamed in the endElement call @@ -132,6 +136,10 @@ if (repeaterWidget && !(widget instanceof Repeater)) throw new SAXException("WoodyTemplateTransformer: the element \"repeater-widget\" can only be used for repeater widgets."); } else if (inWidgetElement) { + if (elementNestingCounter == widgetElementNesting + 1 && + Constants.WI_NS.equals(namespaceURI) && STYLING_EL.equals(localName)) { + gotStylingElement = true; + } xmlCompiler.startElement(namespaceURI, localName, qName, attributes); } else if (namespaceURI.equals(Constants.WT_NS)) { if (localName.equals("widget-label")) { @@ -487,9 +495,15 @@ if (elementNesting == 0 && saxFragment != null) { interpreter.setContentHandler(contentHandler); interpreter.setLexicalHandler(lexicalHandler); - contentHandler.startElement(Constants.WI_NS, STYLING_EL, Constants.WI_PREFIX_COLON + STYLING_EL, Constants.EMPTY_ATTRS); - interpreter.deserialize(saxFragment); - contentHandler.endElement(Constants.WI_NS, STYLING_EL, Constants.WI_PREFIX_COLON + STYLING_EL); + if (gotStylingElement) { + // Just deserialize + interpreter.deserialize(saxFragment); + } else { + // Insert an enclosing + contentHandler.startElement(Constants.WI_NS, STYLING_EL, Constants.WI_PREFIX_COLON + STYLING_EL, Constants.EMPTY_ATTRS); + interpreter.deserialize(saxFragment); + contentHandler.endElement(Constants.WI_NS, STYLING_EL, Constants.WI_PREFIX_COLON + STYLING_EL); + } } super.endElement(uri, loc, raw); } 1.9 +3 -1 cocoon-2.1/src/blocks/woody/samples/xsl/html/woody-default.xsl Index: woody-default.xsl =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/xsl/html/woody-default.xsl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- woody-default.xsl 16 Aug 2003 20:41:04 -0000 1.8 +++ woody-default.xsl 17 Aug 2003 21:03:42 -0000 1.9 @@ -31,7 +31,9 @@ - + + +