Mailing List Archive

Custom XSL pipeline in sitemap.xmap causes build error
Hi there,

I have added a custom DTD, which seems to be working fine. I would like
all the files with the md-v1.0 DTD declared in the DOCTYPE to use a
custom XSL.

I have the following in my local sitemap.xmap:

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:selectors default="parameter">
<map:selector logger="sitemap.selector.parameter" name="parameter"
src="org.apache.cocoon.selection.ParameterSelector" />
</map:selectors>
<map:actions>
<map:action logger="sitemap.action.sourcetype" name="sourcetype"
src="org.apache.forrest.sourcetype.SourceTypeAction">
<sourcetype name="md-v1.0">
<document-declaration public-id="-//MyDoc//DTD MyDoc
Document V1.0//EN" />
</sourcetype>
</map:action>
</map:actions>
</map:components>

<map:pipelines>
<map:pipeline>
<map:match pattern="**.xml">
<map:generate src="{properties:content.xdocs}{1}{2}.xml" />
<map:act type="sourcetype"
src="{properties:content.xdocs}{1}{2}.xml">
<map:select type="parameter">
<map:parameter name="parameter-selector-test"
value="{sourcetype}" />
<map:when test="md-v1.0">
<map:transform
src="{properties:resources.stylesheets}/mydoc-to-document.xsl" />
</map:when>
</map:select>
</map:act>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>


When I run Forrest, I get the following:

"linkmap.html BROKEN: C:\Forrest0_8\apache-forrest-0.8\main\webapp\.
(Access is denied)"

Any help appreciated.

Thanks,

Steve

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Re: Custom XSL pipeline in sitemap.xmap causes build error [ In reply to ]
On 06/06/07, Steve Odlind <SOdlind@omniture.com> wrote:
>
> I have added a custom DTD, which seems to be working fine. I would like
> all the files with the md-v1.0 DTD declared in the DOCTYPE to use a
> custom XSL.
>
> I have the following in my local sitemap.xmap:
>
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="**.xml">
> <map:generate src="{properties:content.xdocs}{1}{2}.xml" />

[...]

> When I run Forrest, I get the following:
>
> "linkmap.html BROKEN: C:\Forrest0_8\apache-forrest-0.8\main\webapp\.
> (Access is denied)"

(I've not reproduced your error, I'm working from what I think is the
problem so tread carefully and come back if my assumptions appear
incorrect)

The problem is that you pattern is way too general. It will match all
requests for an xml document. It is failing on linkmap.xml as this is
the first page processed with a linkmap.xml request.

The issue arises because a pipeline is considered to have been
processed if the generator is fired up. In this case there is no test
to see if the generator in this match should be fired or not.
Therefore it will always fire.

There are two (easy) solutions to your problem:

a) use a narrower match that will only work when you know the custom
DTD is to be used
b) don't worry about the match, just redefine the sourcetype action
that does the processing

Advantages of a) are that it is faster and easier to maintain. The
disadvantage is that you have to have all your custom DTD documents in
a single path and this may not be possible. You could use a regular
expression in the match to get around this problem, but you are still
limited.

Advantages of b) are that it will work with any file in any location.
Disadvantages include it is less efficient as the file type needs to
be tested before it is processed and it is harder to maintain when you
upgrade Forrest.

If you go for a) then simply change your match to something like:

<map:match pattern="myCustomDocs/**.xml">

If you go for b) then copy the following elements from forrest.xmap
and add your custom DTD and transformation to them:

<map:action logger="sitemap.action.sourcetype" name="sourcetype"
src="org.apache.forrest.sourcetype.SourceTypeAction">

...

<map:resource name="transform-to-document">

Interestingly, your question gives me an idea of how we can make this
easier in the next version of Forrest. But I'll take that to the dev
list when I get time.

Ross
RE: Custom XSL pipeline in sitemap.xmap causes build error [ In reply to ]
>>There are two (easy) solutions to your problem:

>>a) use a narrower match that will only work when you know the custom
>>DTD is to be used
>>b) don't worry about the match, just redefine the sourcetype action
>>that does the processing

>>If you go for a) then simply change your match to something like:

>><map:match pattern="myCustomDocs/**.xml">

>>If you go for b) then copy the following elements from forrest.xmap
>>and add your custom DTD and transformation to them:

>><map:action logger="sitemap.action.sourcetype" name="sourcetype"
>>src="org.apache.forrest.sourcetype.SourceTypeAction">

>><map:resource name="transform-to-document">

Unfortunately, both approaches result in the following error message:

"BROKEN: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node
where it is not permitted."

Is there something wrong with my site, or the XSL?

Thanks,

Steve


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
RE: Custom XSL pipeline in sitemap.xmap causes build error [ In reply to ]
On Wed, 2007-06-06 at 18:18 +0100, Steve Odlind wrote:
> >>There are two (easy) solutions to your problem:
>
> >>a) use a narrower match that will only work when you know the custom
> >>DTD is to be used
> >>b) don't worry about the match, just redefine the sourcetype action
> >>that does the processing
>
> >>If you go for a) then simply change your match to something like:
>
> >><map:match pattern="myCustomDocs/**.xml">
>
> >>If you go for b) then copy the following elements from forrest.xmap
> >>and add your custom DTD and transformation to them:
>
> >><map:action logger="sitemap.action.sourcetype" name="sourcetype"
> >>src="org.apache.forrest.sourcetype.SourceTypeAction">
>
> >><map:resource name="transform-to-document">
>
> Unfortunately, both approaches result in the following error message:
>
> "BROKEN: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node
> where it is not permitted."
>
> Is there something wrong with my site, or the XSL?

As I read the error your xsl/xml.

salu2
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions
Re: Custom XSL pipeline in sitemap.xmap causes build error [ In reply to ]
Ross Gardler wrote:
> Steve Odlind wrote:
> >
> >I have added a custom DTD, which seems to be working fine. I would like
> >all the files with the md-v1.0 DTD declared in the DOCTYPE to use a
> >custom XSL.
> >
> >I have the following in my local sitemap.xmap:
> >
> > <map:pipelines>
> > <map:pipeline>
> > <map:match pattern="**.xml">
> > <map:generate src="{properties:content.xdocs}{1}{2}.xml" />
>
> [...]
>
> >When I run Forrest, I get the following:
> >
> >"linkmap.html BROKEN: C:\Forrest0_8\apache-forrest-0.8\main\webapp\.
> >(Access is denied)"
>
> (I've not reproduced your error, I'm working from what I think is the
> problem so tread carefully and come back if my assumptions appear
> incorrect)
>
> The problem is that you pattern is way too general. It will match all
> requests for an xml document. It is failing on linkmap.xml as this is
> the first page processed with a linkmap.xml request.
>
> The issue arises because a pipeline is considered to have been
> processed if the generator is fired up. In this case there is no test
> to see if the generator in this match should be fired or not.
> Therefore it will always fire.
>
> There are two (easy) solutions to your problem:
>
> a) use a narrower match that will only work when you know the custom
> DTD is to be used
> b) don't worry about the match, just redefine the sourcetype action
> that does the processing
>
> Advantages of a) are that it is faster and easier to maintain. The
> disadvantage is that you have to have all your custom DTD documents in
> a single path and this may not be possible. You could use a regular
> expression in the match to get around this problem, but you are still
> limited.
>
> Advantages of b) are that it will work with any file in any location.
> Disadvantages include it is less efficient as the file type needs to
> be tested before it is processed and it is harder to maintain when you
> upgrade Forrest.

If you use DTDs then the DTD files need to be located
and the input documents need to be validated.
However those can be declared to be excluded
via the forrest.properties file.

As Ross says below, this uses the SourceTypeAction, i.e.
Content Aware Pipelines
http://forrest.apache.org/docs/dev/cap.html

That describes an alternative to DTDs. Use the namespace method
(and perhaps RELAX NG if you want external validation).
Caveat: I have not yet tried this.

-David

> If you go for a) then simply change your match to something like:
>
> <map:match pattern="myCustomDocs/**.xml">
>
> If you go for b) then copy the following elements from forrest.xmap
> and add your custom DTD and transformation to them:
>
> <map:action logger="sitemap.action.sourcetype" name="sourcetype"
> src="org.apache.forrest.sourcetype.SourceTypeAction">
>
> ...
>
> <map:resource name="transform-to-document">
>
> Interestingly, your question gives me an idea of how we can make this
> easier in the next version of Forrest. But I'll take that to the dev
> list when I get time.
>
> Ross
Re: Custom XSL pipeline in sitemap.xmap causes build error [ In reply to ]
Steve Odlind wrote:
>
> Hi there,
>
> I have added a custom DTD, which seems to be working fine. I would like
> all the files with the md-v1.0 DTD declared in the DOCTYPE to use a
> custom XSL.
>
> I have the following in my local sitemap.xmap:
>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> <map:components>
> <map:selectors default="parameter">
> <map:selector logger="sitemap.selector.parameter" name="parameter"
> src="org.apache.cocoon.selection.ParameterSelector" />
> </map:selectors>
> <map:actions>
> <map:action logger="sitemap.action.sourcetype" name="sourcetype"
> src="org.apache.forrest.sourcetype.SourceTypeAction">
> <sourcetype name="md-v1.0">
> <document-declaration public-id="-//MyDoc//DTD MyDoc
> Document V1.0//EN" />
> </sourcetype>
> </map:action>
> </map:actions>
> </map:components>
>
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="**.xml">
> <map:generate src="{properties:content.xdocs}{1}{2}.xml" />
> <map:act type="sourcetype"
> src="{properties:content.xdocs}{1}{2}.xml">
> <map:select type="parameter">
> <map:parameter name="parameter-selector-test"
> value="{sourcetype}" />
> <map:when test="md-v1.0">
> <map:transform
> src="{properties:resources.stylesheets}/mydoc-to-document.xsl" />
> </map:when>
> </map:select>
> </map:act>
> <map:serialize type="xml"/>

This needs to be serialise type="xml-document", i.e.
Forrest's internal format.

-David

> </map:match>
> </map:pipeline>
> </map:pipelines>
> </map:sitemap>
>
>
> When I run Forrest, I get the following:
>
> "linkmap.html BROKEN: C:\Forrest0_8\apache-forrest-0.8\main\webapp\.
> (Access is denied)"
>
> Any help appreciated.
>
> Thanks,
>
> Steve
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
Re: Custom XSL pipeline in sitemap.xmap causes build error [ In reply to ]
Thorsten Scherler wrote:
> Steve Odlind wrote:
> > >>There are two (easy) solutions to your problem:
> >
> > >>a) use a narrower match that will only work when you know the custom
> > >>DTD is to be used
> > >>b) don't worry about the match, just redefine the sourcetype action
> > >>that does the processing
> >
> > >>If you go for a) then simply change your match to something like:
> >
> > >><map:match pattern="myCustomDocs/**.xml">
> >
> > >>If you go for b) then copy the following elements from forrest.xmap
> > >>and add your custom DTD and transformation to them:
> >
> > >><map:action logger="sitemap.action.sourcetype" name="sourcetype"
> > >>src="org.apache.forrest.sourcetype.SourceTypeAction">
> >
> > >><map:resource name="transform-to-document">
> >
> > Unfortunately, both approaches result in the following error message:
> >
> > "BROKEN: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node
> > where it is not permitted."
> >
> > Is there something wrong with my site, or the XSL?
>
> As I read the error your xsl/xml.

Steve, is this error reported when you do 'forrest run'
and request localhost:8888/blah/index.html ?

Does your internal xml look okay? i.e. localhost:8888/blah/index.xml
Compare that with
cd $FORREST_HOME/site-author
forrest run
localhost:8888/index.xml

It sounds like your "-to-document" XSL transformation
is the problem. If you still have issues, then please
prepare a basic site demo by doing
'cd my-demo; forrest seed-basic' and add a minimal
example. Open a Jira issue and add your demo:
http://forrest.apache.org/issues.html

-David