bloritsch 01/02/27 07:43:41
Modified: src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: xml-cocoon2 sitemap.xsl
Log:
Made parameter handling code more robust
Revision Changes Path
No revision
No revision
1.1.2.85 +19 -19
xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
retrieving revision 1.1.2.84
retrieving revision 1.1.2.85
diff -u -r1.1.2.84 -r1.1.2.85
--- sitemap.xsl 2001/02/27 13:47:13 1.1.2.84
+++ sitemap.xsl 2001/02/27 15:43:39 1.1.2.85
@@ -94,7 +94,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.1.2.84 2001/02/27 13:47:13 dims Exp
$
+ * @version CVS $Id: sitemap.xsl,v 1.1.2.85 2001/02/27 15:43:39
bloritsch 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"/>";
@@ -629,7 +629,9 @@
</xsl:variable>
<!-- collect the parameters -->
- <xsl:apply-templates select="parameter"/>
+ <xsl:apply-templates select="parameter">
+ <xsl:with-param name="param">param</xsl:with-param>
+ </xsl:apply-templates>
<!-- generate the invocation of the act method of the action component
-->
<xsl:choose>
@@ -672,24 +674,17 @@
</xsl:variable>
<!-- test if we have to define parameters for this action -->
- <xsl:if test="count(parameter)>0">
- nparam = new Parameters ();
- </xsl:if>
+ nparam = new Parameters ();
<!-- generate the value used for the parameter argument in the
invocation of the act method of this action -->
- <xsl:variable name="component-param">
- <xsl:choose>
- <xsl:when test="count(parameter)>0">
- param
- </xsl:when>
- <xsl:otherwise>
- nparam
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
+ <xsl:variable name="component-param">nparam</xsl:variable>
<!-- collect the parameters -->
- <xsl:apply-templates select="parameter"/>
+ <xsl:apply-templates select="parameter">
+ <xsl:with-param name="param" select="$component-param"/>
+ </xsl:apply-templates>
+
+ nparam.merge(param);
<!-- generate the invocation of the act method of the action component
-->
<xsl:choose>
@@ -749,7 +744,9 @@
</xsl:variable>
<!-- collect the parameters -->
- <xsl:apply-templates select="parameter"/>
+ <xsl:apply-templates select="parameter">
+ <xsl:with-param name="param">param</xsl:with-param>
+ </xsl:apply-templates>
<!-- generate the invocation of the act method of the action component
-->
<xsl:choose>
@@ -884,7 +881,8 @@
<!-- collect parameter definitions -->
<xsl:template match="map:pipeline//parameter | map:action-set//parameter">
- param.setParameter ("<xsl:value-of select="@name"/>",
substitute(listOfMaps, "<xsl:value-of select="@value"/>"));
+ <xsl:param name="param"/>
+ <xsl:value-of select="$param"/>.setParameter ("<xsl:value-of
select="@name"/>", substitute(listOfMaps, "<xsl:value-of select="@value"/>"));
</xsl:template>
<!-- FIXME:(GP) is this still valid? -->
@@ -1047,7 +1045,9 @@
</xsl:variable>
<!-- collect the parameters -->
- <xsl:apply-templates select="parameter"/>
+ <xsl:apply-templates select="parameter">
+ <xsl:with-param name="param">param</xsl:with-param>
+ </xsl:apply-templates>
getLogger().debug("Component <xsl:value-of
select="$prefix"/>:<xsl:value-of select="$component-type"/>(<xsl:value-of
select="$component-param"/>)");
<!-- determine the right invokation according to "has a src attribute"
and "has a mime-type attribute" -->