I've gotten "itched" about the number of samples with links to Source, Sitemap and [Resources] (top right links) that don't work properly and apparently can't work because of the implementation in simple-page2html.xsl (src/webapp/samples/common/style/xsl/html/simple-page2html.xsl).

Take for example the flow calculator sample. The sitemap link links to the root sitemap which is irrelevant to the sample. The Source link on the screen pages within the demo have the continuation id incorrectly inserted into the path to the xsp source.

The problem stems from the way simple-page2html.xsl determines the location of these resources. It assumes for instance that the sitemap of a sample will always be located at substring-before($servletPath,$sitemapURI)/sitemap.xmap. In the calc sample, the sitemapURI is something like page/screens/getNumberA.xsp and servletPath is /samples/flow/calc/ and then /samples/flow/calc/continue.yaddayadda so this is yielding empty string for the relative path of sitemap.xmap and hence the root sitemap. The Source links are just wrong because the continuation ID is in the URL but has nothing to do with the filesystem location of anything. This is part of the beauty of Cocoon and is being ignored by the stylesheet.

I tried to manipulate the system as is to get the correct links and could not figure out a way to do so. How to fix this witout breaking others which already work? My current thought is to have the samples sitemap pass in the relevant paths directly and take all path calculation out of the stylesheet. We'd need:

- the base dir of the samples source.
- the sitemap, Source, and resource links relative to that base dir.
- possibly the servlet path for constructing the ?cocoon-view link (though this is not defined for all samples and is generated indiscriminately)


But this means touching every sample in all likelyhood unless a clean back-compatible merger is possible. Anyone looked at this or have advice?

Sorry for all the words, don't have time to trim down any more (you should have seen the original!)

Geoff


Reply via email to