cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject [C2][Patch] XSP namespace attributes (was: I can't declare a namespace in XSP)
Date Thu, 26 Apr 2001 14:14:29 GMT


Sylvain Wallez a écrit :
> 
> giacomo a écrit :
<snip/>
> >
> > I think you discovered a bug in the XSP engine. I've put a
> > LogTransformer after the xsp generator into the sitemap. Yes, it report
> > the start-/endPrefixMappings correctly but as I think having discovered
> > with the ContentAggregator that is not enough. It should add them as
> > xmlns attributes to the following element.
> >
> 
> Quoting the org.xml.sax.ContentHandler#startElement javadoc :
> The attribute list will contain attributes used for Namespace
> declarations (xmlns* attributes) only if the
> http://xml.org/sax/features/namespace-prefixes property is true (it is
> false by default, and support for a true value is optional).
> 
> I grep'ed the sources for this feature and found it in
> AbstractMarkupLanguage.java, LogicSheet.java and JaxpParser.java (does
> it mean all places where parsing occurs?). So obviously Cocoon needs it.
> 
> > Can anybody take a look at it, must be in the xsp.xsl file.
> 
> I can do it (I did a previous patch for removing unneeded namespace
> generation), but could someone explain me why it's needed and
> start/endPrefixMappings aren't enough ?
> 

Done ! Please find attached patches that (I hope finally) solve the XSP
namespace problems.

Here are the changes :
- check if we should declare namespaces as attributes. This depends on
the parser/xsl processor combination that's used : Xerces+Xalan require
it, while Xerces+Saxon do not (xmlns attributes are generated).

- moved top-level namespaces declaration from the "xsp:page" template to
the "process-first-element" template because we need namespace
information from that first element to avoid duplicate namespace
generation.

- after the previous change, the generate() method only contains a call
to generateContent(), so I merged both.

- added XML_NAMESPACE_URI Constants.java for the xmlns namespace URI
used in namespaces attributes.

Could you please apply these patches ?

-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com
Mime
View raw message