You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jan-Willem Boer <jb...@be-value.nl> on 2007/06/21 13:07:05 UTC
catalog and xslt document() function
Hi,
I ran into a problem with the catalog file and the xslt document() function.
To include a document into the XML that flows through a Cocoon pipeline,
I am using the document() function in an XSLT stylesheet:
<xsl:copy-of select="document(@path)"/>
The document-to-include contains a DOCTYPE declaration referring to an
external entity:
<!DOCTYPE something PUBLIC "-//Company//DTD SOMETHING-XML//NL"
"something.dtd">
I added the DTD-file to the directory WEB-INF/entities and added a line
to the catalog file containing the PUBLIC and SYSTEM identifiers.
The problem occurs when i use the document function to include the
document directly with an absolute path, the catalog file is ignored,
and the DTD is not found.
To circumvent this, I was forced to redirect the document() function to
a cocoon pipeline like this:
<xsl:copy-of select="document('cocoon://get-file/' + @path)"/>
instead of
<xsl:copy-of select="document(@path)"/>
Cocoon reads the catalog and does not complain, so at least I have it
working now.
I was wondering (1) if this is expected behaviour (2) if there is
another, more elegant way to solve this: can the XSLT processor be
instructed to read the catalog somehow?
Jan Willem Boer
http://www.linkedin.com/in/janwillemboer
Re: catalog and xslt document() function
Posted by Jan-Willem Boer <jb...@be-value.nl>.
Alexander Daniel schreef:
> I don't know direct answers to your questions but I can recommend a
> different approach:
>
> Instead of using the XSLT document() function you could use the
> Include transformer
> (org.apache.cocoon.transformation.IncludeTransformer) which also
> supports caching. We use it successfully in our project.
>
> Alex
>
We do use the cinclude transformer in the same project. But in this case
i need to check the contents of the document before it can be included.
This would require a few extra steps if we would use the cinclude
transformer so that option is not preferable over the xpath document
function.
For example:
<xsl:variable name="doc" select="document(@path)"/>
<xsl:if test="$doc/some-element">
<xsl:copy-of select="$doc"/>
....
I think the XSLT processor should be aware of the catalog file in this
case.
Jan Willem
> On Jun 21, 2007, at 1:21 PM, Jan-Willem Boer wrote:
>
>> Jan Willem Boer schreef:
>>> Hi,
>>>
>>> I ran into a problem with the catalog file and the xslt document()
>>> function.
>>>
>>> To include a document into the XML that flows through a Cocoon
>>> pipeline, I am using the document() function in an XSLT stylesheet:
>>> <xsl:copy-of select="document(@path)"/>
>>>
>>> The document-to-include contains a DOCTYPE declaration referring to
>>> an external entity:
>>> <!DOCTYPE something PUBLIC "-//Company//DTD SOMETHING-XML//NL"
>>> "something.dtd">
>>>
>>> I added the DTD-file to the directory WEB-INF/entities and added a
>>> line to the catalog file containing the PUBLIC and SYSTEM identifiers.
>>>
>>> The problem occurs when i use the document function to include the
>>> document directly with an absolute path, the catalog file is
>>> ignored, and the DTD is not found.
>>> To circumvent this, I was forced to redirect the document() function
>>> to a cocoon pipeline like this:
>>> <xsl:copy-of select="document('cocoon://get-file/' + @path)"/>
>> this should of course be
>> <xsl:copy-of select="document(concat('cocoon://get-file/', @path))"/>
>>>
>>> instead of
>>> <xsl:copy-of select="document(@path)"/>
>>>
>>> Cocoon reads the catalog and does not complain, so at least I have
>>> it working now.
>>>
>>> I was wondering (1) if this is expected behaviour (2) if there is
>>> another, more elegant way to solve this: can the XSLT processor be
>>> instructed to read the catalog somehow?
>>>
>>> Jan Willem Boer
>>> http://www.linkedin.com/in/janwillemboer
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
Re: catalog and xslt document() function
Posted by Alexander Daniel <al...@gmx.at>.
I don't know direct answers to your questions but I can recommend a
different approach:
Instead of using the XSLT document() function you could use the
Include transformer
(org.apache.cocoon.transformation.IncludeTransformer) which also
supports caching. We use it successfully in our project.
Alex
On Jun 21, 2007, at 1:21 PM, Jan-Willem Boer wrote:
> Jan Willem Boer schreef:
>> Hi,
>>
>> I ran into a problem with the catalog file and the xslt document()
>> function.
>>
>> To include a document into the XML that flows through a Cocoon
>> pipeline, I am using the document() function in an XSLT stylesheet:
>> <xsl:copy-of select="document(@path)"/>
>>
>> The document-to-include contains a DOCTYPE declaration referring
>> to an external entity:
>> <!DOCTYPE something PUBLIC "-//Company//DTD SOMETHING-XML//NL"
>> "something.dtd">
>>
>> I added the DTD-file to the directory WEB-INF/entities and added a
>> line to the catalog file containing the PUBLIC and SYSTEM
>> identifiers.
>>
>> The problem occurs when i use the document function to include the
>> document directly with an absolute path, the catalog file is
>> ignored, and the DTD is not found.
>> To circumvent this, I was forced to redirect the document()
>> function to a cocoon pipeline like this:
>> <xsl:copy-of select="document('cocoon://get-file/' + @path)"/>
> this should of course be
> <xsl:copy-of select="document(concat('cocoon://get-file/', @path))"/>
>>
>> instead of
>> <xsl:copy-of select="document(@path)"/>
>>
>> Cocoon reads the catalog and does not complain, so at least I have
>> it working now.
>>
>> I was wondering (1) if this is expected behaviour (2) if there is
>> another, more elegant way to solve this: can the XSLT processor be
>> instructed to read the catalog somehow?
>>
>> Jan Willem Boer
>> http://www.linkedin.com/in/janwillemboer
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: catalog and xslt document() function
Posted by Jan-Willem Boer <jb...@be-value.nl>.
Jan Willem Boer schreef:
> Hi,
>
> I ran into a problem with the catalog file and the xslt document()
> function.
>
> To include a document into the XML that flows through a Cocoon
> pipeline, I am using the document() function in an XSLT stylesheet:
> <xsl:copy-of select="document(@path)"/>
>
> The document-to-include contains a DOCTYPE declaration referring to an
> external entity:
> <!DOCTYPE something PUBLIC "-//Company//DTD SOMETHING-XML//NL"
> "something.dtd">
>
> I added the DTD-file to the directory WEB-INF/entities and added a
> line to the catalog file containing the PUBLIC and SYSTEM identifiers.
>
> The problem occurs when i use the document function to include the
> document directly with an absolute path, the catalog file is ignored,
> and the DTD is not found.
> To circumvent this, I was forced to redirect the document() function
> to a cocoon pipeline like this:
> <xsl:copy-of select="document('cocoon://get-file/' + @path)"/>
this should of course be
<xsl:copy-of select="document(concat('cocoon://get-file/', @path))"/>
>
> instead of
> <xsl:copy-of select="document(@path)"/>
>
> Cocoon reads the catalog and does not complain, so at least I have it
> working now.
>
> I was wondering (1) if this is expected behaviour (2) if there is
> another, more elegant way to solve this: can the XSLT processor be
> instructed to read the catalog somehow?
>
> Jan Willem Boer
> http://www.linkedin.com/in/janwillemboer