You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Jan-Philipp Schiller <le...@biberbeatz.de> on 2004/11/05 14:39:27 UTC
Pattern matching question
Hi,
I know it is a simple question but I am stuck here. Maybe you can give
me a quick answer. I tried so much...
I have a doctype called "startpage" and I want to match it in the
publication-sitemap
<!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
<map:match pattern="lenyabody-*/*/*/startpage/**">
<map:aggregate element="cmsbody">
<map:part src="cocoon://navigation/{2}/{3}/breadcrumb/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/tabs/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/menu/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/search/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/footer/{5}.xml"/>
<map:part
src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}"/>
</map:aggregate>
<map:transform src="xslt/startpagelook2xhtml.xsl">
so that I can use a startpagelookxhtml.xsl for transformation.
The comment confuses me:
/lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url}
How can I match the doctype "startpage"in the pattern so that every
document that has the doctype "startpage" is handled by this stylesheet.
I think it must be very easy but I cannot find out today :-)
Thanks,
Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org
Re: Pattern matching question
Posted by Nele Vogel <vg...@sevencs.com>.
Hi Jan!
Some additional thoughts :)
> How can I match the doctype "startpage"in the pattern so that every
> document that has the doctype "startpage" is handled by this stylesheet.
If you want to match your doctype "startpage" anyway, you have to put your
matcher <map:match pattern="lenyabody-*/*/*/startpage/**"> _before_ this
matcher <map:match pattern="lenyabody-*/*/*/*/**">. You would have to handle
the part of the aggregation which is referring to the matcher
"lenya-document-*/*/*/**.xml" in a new pipeline inside "doctypes.xmap".
An easier way to do it would be using the the matcher in
"publication-sitemap.xmap", which already handles your doctype, and just
adding a new matcher to "doctypes.xmap" that matches your doctype and uses
your xslt.
I recommend writing a "startpage2xhtml.xsl" transformation. :)
Good luck!
Greetings,
Nele.
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org
Re: Pattern matching question
Posted by Nele Vogel <vg...@sevencs.com>.
Hi Jan!
>>>I know it is a simple question but I am stuck here. Maybe you can give
>>>me a quick answer. I tried so much...
>>>
>>>I have a doctype called "startpage" and I want to match it in the
>>>publication-sitemap
>>>
>>><!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
>>>
>>> <map:match pattern="lenyabody-*/*/*/startpage/**">
>>> <map:aggregate element="cmsbody">
>>> <map:part src="cocoon://navigation/{2}/{3}/breadcrumb/{5}.xml"/>
>>> <map:part src="cocoon://navigation/{2}/{3}/tabs/{5}.xml"/>
>>> <map:part src="cocoon://navigation/{2}/{3}/menu/{5}.xml"/>
>>> <map:part src="cocoon://navigation/{2}/{3}/search/{5}.xml"/>
>>> <map:part src="cocoon://navigation/{2}/{3}/footer/{5}.xml"/>
>>> <map:part
>>>src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}"/>
>>> </map:aggregate>
>>> <map:transform src="xslt/startpagelook2xhtml.xsl">
>>>
>>>so that I can use a startpagelookxhtml.xsl for transformation.
>>>The comment confuses me:
>>>/lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url}
>>
>> The <map:match> element already matches your doctype. All you have to do is
>> write a "startpage2xhtml.xsl" transformation and put it in your
>> $PUBLICATION/xslt directory. :)
>
> I have that stylesheet placed there. But I get the error message:
>
> /xslt/{document-id}.html2xhtml.xsl (No such file or directory).
> Something is still wrong with my pipeline
>> The element <map:part
>> src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}> is
>> matched inside "publication-sitemap.xmap". The corresponding pipeline
>> (pattern="lenya-document-*/*/*/**.xml") referrs to "doctypes.xmap" where the
>> generated xml stream is transformed using "yourdoctype2xhtml.xsl" (in your
>> case startpage2xhtml.xsl).
>>
>>
>>>How can I match the doctype "startpage"in the pattern so that every
>>>document that has the doctype "startpage" is handled by this stylesheet.
>>
>> If you want to match your doctype "startpage" anyway, you have to put your
>> matcher <map:match pattern="lenyabody-*/*/*/startpage/**"> _before_ this
>> matcher <map:match pattern="lenyabody-*/*/*/*/**">.
>
> I placed it before.
>
>>You would have to handle
>> the part of the aggregation which is referring to the matcher
>> "lenya-document-*/*/*/**.xml" in a new pipeline inside "doctypes.xmap".
>
> Created a new matcher in doctypes.xmap:
>
> <map:match pattern="*/*/startpage/**.xml">
> <map:generate src="content/{2}/{4}.xml"/>
> <map:transform src="xslt/{3}2xhtml.xsl">
> <map:parameter name="rendertype" value="{1}"/>
> <map:parameter name="nodeid"
> value="{page-envelope:document-node-id}"/>
> </map:transform>
> <map:serialize type="xml"/>
> </map:match>
>
> I do not exactly understand the meaning of variables / placeholder like
> {2}, {4}, etc. in this case.
In your matcher you replaced
pattern="*/*/*/**.xml by
pattern="*/*/startpage/**.xml
In the first case you have four variables, in the second case only three:
pattern=" * / * / * / ** .xml
{1} {2} {3} {4}
pattern=" * / * /startpage/**.xml
{1} {2} {3}
The transformer map:transform src="xslt/{3}2xhtml.xsl" still uses variable {3}
to create the name of your xsl file. In your case, variable {3} corresponds to
** (which is the url), _not_ to "startpage".
Hope this helps.
Greetings,
Nele
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org
Re: Pattern matching question
Posted by Nele Vogel <vg...@sevencs.com>.
Hi Jan!
Have a look at http://wiki.apache.org/cocoon-lenya/AddingCustomDocType - this
is a description of how to add a new doctype to Lenya.
Greetings,
Nele
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org
Re: Pattern matching question
Posted by Jan-Philipp Schiller <le...@biberbeatz.de>.
Nele Vogel wrote:
> Hi Jan!
>
>
>>I know it is a simple question but I am stuck here. Maybe you can give
>>me a quick answer. I tried so much...
>>
>>I have a doctype called "startpage" and I want to match it in the
>>publication-sitemap
>>
>><!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
>>
>> <map:match pattern="lenyabody-*/*/*/startpage/**">
>> <map:aggregate element="cmsbody">
>> <map:part src="cocoon://navigation/{2}/{3}/breadcrumb/{5}.xml"/>
>> <map:part src="cocoon://navigation/{2}/{3}/tabs/{5}.xml"/>
>> <map:part src="cocoon://navigation/{2}/{3}/menu/{5}.xml"/>
>> <map:part src="cocoon://navigation/{2}/{3}/search/{5}.xml"/>
>> <map:part src="cocoon://navigation/{2}/{3}/footer/{5}.xml"/>
>> <map:part
>>src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}"/>
>> </map:aggregate>
>> <map:transform src="xslt/startpagelook2xhtml.xsl">
>>
>>so that I can use a startpagelookxhtml.xsl for transformation.
>>The comment confuses me:
>>/lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url}
>
> The <map:match> element already matches your doctype. All you have to do is
> write a "startpage2xhtml.xsl" transformation and put it in your
> $PUBLICATION/xslt directory. :)
I have that stylesheet placed there. But I get the error message:
/xslt/{document-id}.html2xhtml.xsl (No such file or directory).
Something is still wrong with my pipeline
> The element <map:part
> src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}> is
> matched inside "publication-sitemap.xmap". The corresponding pipeline
> (pattern="lenya-document-*/*/*/**.xml") referrs to "doctypes.xmap" where the
> generated xml stream is transformed using "yourdoctype2xhtml.xsl" (in your
> case startpage2xhtml.xsl).
>
>
>>How can I match the doctype "startpage"in the pattern so that every
>>document that has the doctype "startpage" is handled by this stylesheet.
>
> If you want to match your doctype "startpage" anyway, you have to put your
> matcher <map:match pattern="lenyabody-*/*/*/startpage/**"> _before_ this
> matcher <map:match pattern="lenyabody-*/*/*/*/**">.
I placed it before.
>You would have to handle
> the part of the aggregation which is referring to the matcher
> "lenya-document-*/*/*/**.xml" in a new pipeline inside "doctypes.xmap".
Created a new matcher in doctypes.xmap:
<map:match pattern="*/*/startpage/**.xml">
<map:generate src="content/{2}/{4}.xml"/>
<map:transform src="xslt/{3}2xhtml.xsl">
<map:parameter name="rendertype" value="{1}"/>
<map:parameter name="nodeid"
value="{page-envelope:document-node-id}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
I do not exactly understand the meaning of variables / placeholder like
{2}, {4}, etc. in this case.
Thanks for your help.
--Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org
Re: Pattern matching question
Posted by Nele Vogel <vg...@sevencs.com>.
Hi Jan!
> I know it is a simple question but I am stuck here. Maybe you can give
> me a quick answer. I tried so much...
>
> I have a doctype called "startpage" and I want to match it in the
> publication-sitemap
>
> <!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
>
> <map:match pattern="lenyabody-*/*/*/startpage/**">
> <map:aggregate element="cmsbody">
> <map:part src="cocoon://navigation/{2}/{3}/breadcrumb/{5}.xml"/>
> <map:part src="cocoon://navigation/{2}/{3}/tabs/{5}.xml"/>
> <map:part src="cocoon://navigation/{2}/{3}/menu/{5}.xml"/>
> <map:part src="cocoon://navigation/{2}/{3}/search/{5}.xml"/>
> <map:part src="cocoon://navigation/{2}/{3}/footer/{5}.xml"/>
> <map:part
> src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}"/>
> </map:aggregate>
> <map:transform src="xslt/startpagelook2xhtml.xsl">
>
> so that I can use a startpagelookxhtml.xsl for transformation.
> The comment confuses me:
> /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url}
The <map:match> element already matches your doctype. All you have to do is
write a "startpage2xhtml.xsl" transformation and put it in your
$PUBLICATION/xslt directory. :)
The element <map:part
src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}> is
matched inside "publication-sitemap.xmap". The corresponding pipeline
(pattern="lenya-document-*/*/*/**.xml") referrs to "doctypes.xmap" where the
generated xml stream is transformed using "yourdoctype2xhtml.xsl" (in your
case startpage2xhtml.xsl).
> How can I match the doctype "startpage"in the pattern so that every
> document that has the doctype "startpage" is handled by this stylesheet.
If you want to match your doctype "startpage" anyway, you have to put your
matcher <map:match pattern="lenyabody-*/*/*/startpage/**"> _before_ this
matcher <map:match pattern="lenyabody-*/*/*/*/**">. You would have to handle
the part of the aggregation which is referring to the matcher
"lenya-document-*/*/*/**.xml" in a new pipeline inside "doctypes.xmap".
Hope this helps.
Greetings,
Nele.
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org