cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Phillips <rawd...@teleport.com>
Subject Re: C2 vs C1; sitemap issues
Date Fri, 29 Dec 2000 13:46:18 GMT
is there a documentation reference for the matching components?
I haven't found one in C2 docs or in the archived list, before now.

bob

At 09:25 AM 12/24/2000 -0500, you wrote:
>----- Original Message -----
>From: Christian Parpart <cparpart@t-online.de>
>To: Cocoon-Users <cocoon-users@xml.apache.org>
>Sent: Sunday, December 24, 2000 6:34 AM
>Subject: C2 vs C1; sitemap issues
>
>
>> Hi all,
>>
>> after configuring Cocoon2 and Tomcat/4.0-m5 in success
>> by testing its demo page at http://localhost:8080/cocoon
>> I am now interested in how to get Cocoon to transform
>> all my xml files.
>>
>> New in C2 is the sitemap.xmap file. One of its tasks is
>> to match the requested path and to transform the file to
>> any format(html,xml,pdf,...):
>>
>>    <map:match pattern="welcome">
>>     <map:generate src="docs/samples/samples.xml"/>
>>     <map:transform src="stylesheets/simple-samples2html.xsl"/>
>>     <map:serialize/>
>>    </map:match>
>>
>> Here will be matched the http://[host]/cocoon/welcome.
>>   1.) An XML-tree will be generated(?).
>>   2.) An XSL file will be applied to that tree.
>>   3.) This tree will be send as text to the requester (output).
>> Is that right?
>
>Cocoon 2 uses SAX events instead of a DOM tree, but you
>have the general idea.  (Performance blows ColdFusion out
>of the water for comperable complexity in the pages)
>
>> Now an HTML example:
>>
>>    <map:match pattern="hello.html">
>>     <map:generate src="docs/samples/hello-page.xml"/>
>>     <map:transform src="stylesheets/page/simple-page2html.xsl"/>
>>     <map:serialize type="html"/>
>>    </map:match>
>>
>> Here nearly the same procedure as the above example.
>> Only the output will be in text/html, even the default type
>> is text/html too(?).
>
>The Serializer is a specific component specified in the info
>above the sitemap definition.  You have an SVGSerializer
>that converts the XML into an image, an HTML serializer
>that optimizes the HTML for you, and more.
>
>> So now I could conclude that all real .xml files can be found as .html,
>or?
>> Example:
>>
>>    <map:match pattern="*.html">
>>     <map:generate src="{1}.xml"/>
>>     <map:transform src="stylesheets/document.xsl"/>
>>     <map:serialize type="html"/>
>>    </map:match>
>>
>> Now all files ending with the extension .html should be matched with the
>> above(?).
>> e.g.: http://[host]/cocoon/index.html
>> http://[host]/cocoon/path/to/any.html
>>
>> to: http://[host]/cocoon/index.xml
>> http://[host]/cocoon/path/to/any.xml.
>>
>> Is that right?
>
>The single asterisk '*' only matches the current directory.
>in your example above only /*.html would be matched, not
>/foo/*.html.
>
>> Then, I recognized, that I am missing the pi cocoon-process in all xml
>files
>> served by the cocoon engine. In my oppinion, that's why you must tell the
>> map:match tag, wich .xsl document he should use.
>> But, is it possible to declare a stylesheet by using the pi cocoon-process
>> and the pi xml-stylesheet anyway?
>
>You can have it in there, but Cocoon 2 simply ignores it.  That
>functionality
>works in the sitemap.
>
>> And, sometimes, by browsing throw the sitemap.xmap I found thinks like
>> below:
>>
>>    <map:match pattern="images/**.png">
>>     <map:read src="resources/images/{1}.png" mime-type="image/png"/>
>>    </map:match>
>
>This is the wildcard '**' to match this or any descending directory.
>so the path /images/*.png and the path /images/foo/*.png will be
>matched.
>
>> Here are two stars (*) side by side, but in the map:read only {1}.
>> What about {2}, or what exactly does this (**) mean, where is the
>> difference?
>
>'*' matches the current directory only.
>'**' matches the current directory and any child directory
>With {1} and {2} you are matching multiple wildcards:
>
><map:match pattern="/images/**.*">
>  <map:read src="resources/{2}/{1}.{2}" mime-type="image/{2}"/>
></map:match>
>
>when presented with "/images/foo.png" will match this:
>
>/resources/png/foo.png (mime-type="image/png")
>
>When presented with "/images/foo/bar.jpeg" will match this:
>
>/resources/jpeg/foo/bar.jpeg (mime-type="image/jpeg")
>
>> The following copy should match everything, wich isn't matched before,
>> including everthing wich isn't a directory. But the map:generate and the
>> map:transform expects
>>
>>    <map:match pattern="*">
>>     <map:generate type="directory" src="{1}"/>
>>     <map:transform src="stylesheets/system/directory2html.xsl"/>
>>     <map:serialize/>
>>    </map:match>
>
>Should match everything in the current level.  If you got rid of the
>redirect
>at the beginning, you will see effects.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


Mime
View raw message