Hi,

Just to throw in my 0.02c. At my current workplace we solved this issue by 
implementing both a dynamic XML Serializer
and an HTML Serializer. We found that reconfiguring a the serializer for each 
use while risky does work.

Caveat: While this approach has been tested under light load. I cannot say how 
it'll behave under heavy load, we're
still checking. YMMV.

>       public void setup(SourceResolver resolver, Map objectModel, String src, 
> Parameters par) {
>               String configxml = "";
>               String[] parameterNames = par.getNames();
>               for (int i = 0; i < parameterNames.length; i++) {
>                       String paramName = parameterNames[i];
>                       String paramValue = par.getParameter(paramName, null);
>                       if (!paramName.isEmpty() && paramValue != null)
>                               configxml += "<" + paramName + ">" + paramValue 
> + "</" + paramName + ">";
>               }
>               if (configxml.length() > 0) {
>                       configxml = "<settings>" + configxml + "</settings>"; 
> // put settings around to make an 'xml'
>                       try {
>                               DefaultConfigurationBuilder confBuilder = new 
> DefaultConfigurationBuilder();
>                               ByteArrayInputStream stream = new 
> ByteArrayInputStream(configxml.getBytes());
>                               Configuration conf = confBuilder.build(stream);
>                               /****
>                                * all these values are supported - see 
> AbstractTextSerializer cdata-section-elements doctype-public
>                                * doctype-system encoding indent media-type 
> method omit-xml-declaration standalone version
>                                ***************************************/
>                               super.configure(conf);
>                       } catch (ConfigurationException e) {
>                               log.error("ConfigurationException: " + 
> e.getLocalizedMessage(), e);
>                       } catch (SAXException e) {
>                               log.error("SAXException: " + 
> e.getLocalizedMessage(), e);
>                       } catch (IOException e) {
>                               log.error("IOException: " + 
> e.getLocalizedMessage(), e);
>                       }
>               }
>       }


On 15/11/10 05:31, Jos Snellings wrote:
> Hi Martin,
> 
> Do not know details, but it might help if you use the xsl:output element
> in your transformation.
> There is hope that it would not be overridden by the serializer.
> 
> <xsl:output
> method="xml|html|text|name"
> version="string"
> encoding="string"
> omit-xml-declaration="yes|no"
> standalone="yes|no"
> doctype-public="string"
> doctype-system="string"
> cdata-section-elements="namelist"
> indent="yes|no"
> media-type="string"/>
> 
> Cheers,
> Jos
> 
> 
> On 11/12/2010 05:17 PM, Martin Holmes wrote:
>> Hi there,
>>
>> Does anyone know how to configure a serializer for Cocoon 2.1 that
>> will output an HTML5 document? That means a minimal doctype that looks
>> like this:
>>
>> <!DOCTYPE html>
>>
>> served as text/html.
>>
>> Cheers,
>> Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org

Reply via email to