You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2004/07/09 19:29:24 UTC
[Cocoon Wiki] Updated: SitemapVariableSubstitution
Date: 2004-07-09T10:29:24
Editor: JoergHeinicke <jo...@gmx.de>
Wiki: Cocoon Wiki
Page: SitemapVariableSubstitution
URL: http://wiki.apache.org/cocoon/SitemapVariableSubstitution
no comment
Change Log:
------------------------------------------------------------------------------
@@ -1,13 +1,13 @@
-Within the [:sitemap] there are several mechanisms to substitute variables by values.
+Within the [:Sitemap] there are several mechanisms to substitute variables by values.
You define variables by inclosing them into curly brackets.
The most easiest example is a simple Matcher
-{{{
- ...
- <map:match pattern="images/*.gif">
- <map:read src="resources/images/{1}.gif" mime-type="images/gif"/>
- </map:match>
- ...
+{{{
+ ...
+ <map:match pattern="images/*.gif">
+ <map:read src="resources/images/{1}.gif" mime-type="images/gif"/>
+ </map:match>
+ ...
}}}
Where the {1} is replaced by what is matched for the first wildcard "*" and so on.
@@ -17,16 +17,16 @@
an action or a matcher. You have to refer the previous level to get the same value from the Matcher.
This can be done by going backwards just like in a directory by adding a "../" prefix per level.
-{{{
- ...
- <map:match pattern="images/*.gif">
- <map:act type="resource-exists">
- <map:parameter name="url" value="resources/images/{1}.gif">
- <!-- new level -->
- <map:read src="resources/images/{../1}.gif" mime-type="images/gif"/>
- </map:act>
- </map:match>
- ...
+{{{
+ ...
+ <map:match pattern="images/*.gif">
+ <map:act type="resource-exists">
+ <map:parameter name="url" value="resources/images/{1}.gif">
+ <!-- new level -->
+ <map:read src="resources/images/{../1}.gif" mime-type="images/gif"/>
+ </map:act>
+ </map:match>
+ ...
}}}
If your pipelines are very deeply nested (or you just don't want to adjust
@@ -34,31 +34,31 @@
either directly refer to the first/root level by putting a leading slash in front of
your variable
-{{{
- ...
- <map:match pattern="images/*.gif">
- <map:act type="resource-exists">
- <map:parameter name="url" value="resources/images/{1}.gif">
- <!-- new level -->
- <map:read src="resources/images/{/1}.gif" mime-type="images/gif"/>
- </map:act>
- </map:match>
- ...
+{{{
+ ...
+ <map:match pattern="images/*.gif">
+ <map:act type="resource-exists">
+ <map:parameter name="url" value="resources/images/{1}.gif">
+ <!-- new level -->
+ <map:read src="resources/images/{/1}.gif" mime-type="images/gif"/>
+ </map:act>
+ </map:match>
+ ...
}}}
or you use the new anchor syntax. With sitemap variable anchors you
name a specific level and refer to them directly by the specified name.
-{{{
- ...
- <map:match pattern="images/*.gif" name="root">
- <map:act type="resource-exists">
- <map:parameter name="url" value="resources/images/{1}.gif">
- <!-- new level -->
- <map:read src="resources/images/{#root:1}.gif" mime-type="images/gif"/>
- </map:act>
- </map:match>
- ...
+{{{
+ ...
+ <map:match pattern="images/*.gif" name="root">
+ <map:act type="resource-exists">
+ <map:parameter name="url" value="resources/images/{1}.gif">
+ <!-- new level -->
+ <map:read src="resources/images/{#root:1}.gif" mime-type="images/gif"/>
+ </map:act>
+ </map:match>
+ ...
}}}
see also InputModules