cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: Need to include DOCTYPE definition after transform
Date Sat, 31 Jan 2004 09:58:45 GMT
Hallo David,

On 31.01.2004 09:38, David Leangen wrote:
> Hello!
> I am using multiple <map:transform>s in my pipeline. I would like for the
> transforms to output the DOCTYPE declaration. I am using v2.1.3.
> Generally, my sitemap is something like:
>    <map:match pattern="*.html">
>      <map:generate src="{1}.xml"/>
>      <map:transform src="t1.xsl"/>
>      <map:transform src="t2.xsl"/>
>      <map:serialize type="html"/>
>    </map:match>
> After the transform "t1", the intermediate file loses its DOCTYPE.
> Therefore, "t2" will not work properly for me.
> I read in some mailing list that Cocoon (v??) doesn't support <xsl:output>,

that's not quite correct. I heard/read of some cases where setting 
properties via xsl:output works. But we do not recommend to use it in a 
transformer step, but at the serializer. That's also what these 
properties are about: just influencing the serialization of the output.

> but that this can be done with <?cocoon-process type="xxx"?>. However, I
> couldn't find any clear documentation on how to implement this.

No, this won't work. Those processing instruction are very old and were 
in use for Cocoon 1 only. In Cocoon 2.x you have the sitemap to 
influence your processing. This also makes the stylesheets more reusable.

> Can anybody help me with this?
> If you want to know why I need this, keep reading. Otherwise, thanks for
> stopping by!

Understanding your needs is not possible without your explanation below ...

> Reason:
> I have been having a problem with the id() function in Cocoon, and I've
> narrowed down the problem.
> It seems that this only occurs when using more than one <map:transform> in
> the pipeline. If I only use one transform, then the id() function always
> returns an empty string (or NULL, or whatever).
> I've also notice that if I do not include a DOCTYPE declaration, even for a
> since transform, the same behaviour occurs. So, it seems that the DOCTYPE
> definition is absolutely necessary for the id() function to work properly.
> At least this is so in my case, since I am using namespaces.
> Therefore, when I use multiple transforms, after the first transform, the
> DOCTYPE definition gets "erased". Since the DOCTYPE is no longer there, the
> id() function will no longer work in my second transform. So, that's why I
> need to include it.

Indeed the id() function needs the description ID of the DTD. And indeed 
the doctype declaration is not available in multiple transformations. As 
I wrote above setting this property is only about serializing the 
output. But between multiple transformations the output isn't serialized 
and reparsed.

There is no support available for your need at the moment - and I don't 
know if it will ever be. I could imagine that you can set the type of an 
attribute on Java level of XML processing. Or in other words: SAX has an 
attribute function where you have to set the type of the attribute which 
is mostly CDATA. I could imagine that you can set it to ID too, but this 
would need an additional hand-written transformer which sets just the ID 
type of your attributes and probably without any access to a DTD. But 
maybe someone more familiar to XML processing with Java can clearify 
this. Bruno? J.Pietschmann?

If this is not possible you have to and you can replace the id() 
function with the key() function. This is "only" a bit more work within 
the stylesheet, but is independent on a DTD.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message