haul 01/12/07 08:30:56
Modified: src/org/apache/cocoon/components/language/markup/sitemap/java
sitemap.xsl
Log:
Added <map:call resource=""/> as discussed on cocoon-dev
Takes parameters and creates new map containing them.
Will deprecate <map:redirect-to resource=""/> someday.
Revision Changes Path
1.52 +32 -1
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- sitemap.xsl 2001/12/07 10:12:59 1.51
+++ sitemap.xsl 2001/12/07 16:30:56 1.52
@@ -126,7 +126,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Id: sitemap.xsl,v 1.51 2001/12/07 10:12:59 sylvain Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.52 2001/12/07 16:30:56 haul Exp $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
static final String LOCATION = "<xsl:value-of select="translate(@file-path,
'/', '.')"/>.<xsl:value-of select="@file-name"/>";
@@ -1387,6 +1387,37 @@
else
if (true) return sitemapManager.invoke (this.manager, environment,
substitute(listOfMaps,"<xsl:value-of select="@uri-prefix"/>"),
substitute(listOfMaps,"<xsl:value-of select="@src"/>"), <xsl:value-of
select="$check-reload"/>, <xsl:value-of select="$reload-method"/>);
</xsl:template> <!-- match="map:mount" -->
+
+
+
+ <!-- generate the code to redirect a request to an internal resource definition
-->
+ <xsl:template match="map:call">
+ <xsl:if test="map:parameter">
+ map = new HashMap(<xsl:value-of select="count(map:parameter)"/>);
+ <xsl:for-each select="map:parameter">
+ <xsl:variable name="name">
+ <xsl:call-template name="get-parameter">
+ <xsl:with-param name="parname">name</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="value">
+ <xsl:call-template name="get-parameter">
+ <xsl:with-param name="parname">value</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ map.put("<xsl:value-of select="$name"/>", substitute(listOfMaps,
"<xsl:value-of select="$value"/>"));
+ </xsl:for-each>
+ listOfMaps.add(map);
+ this.dumpParameters(listOfMaps);
+ </xsl:if>
+ Class[] argTypes = new Class[] {StreamPipeline.class, EventPipeline.class,
List.class, Environment.class, String.class, Boolean.TYPE};
+ Object[] argValues = new Object[] {pipeline, eventPipeline, listOfMaps,
environment, cocoon_view, new Boolean(internalRequest)};
+ String methodName = "resource_" + substitute(listOfMaps, "<xsl:value-of
select="translate(@resource, '- ', '__')"/>");
+ if (true) return invokeMethod(methodName, argTypes, argValues);
+ </xsl:template><!-- match="map:call" -->
+
+
+
<!-- generate the code to redirect a request -->
<xsl:template match="map:redirect-to">
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]