On 20.Jun.2001 -- 04:20 PM, Vadim Gritsenko wrote:
> I would not say why not to use <map:parameters> as elsewhere else...
> Like:
>     <map:match pattern="test">
>       <map:act type="form-validator">
>          <map:parameter name="descriptor" value="context:///descriptor.xml"/>
>          <map:parameter name="validate-set" value="user-input"/>

>          <map:redirect-to resource="simple-page">
>             <map:parameter name="target" value="OK"/>
>          </map:redirect-to>

>       </map:act>
>       <map:redirect-to resource="simple-page">
>           <map:parameter name="target" value="ERROR"/>
>       </map:redirect-to>
>     </map:match>
> 
> This would be much more consistent.

Vadim, yes that's right. I have reworked the patch so that it stores
the target value with key "target" and that it uses the get-parameter
template which is what other templates use as well. This way target
can be specified either as attribute or as child element.

BUT get-parameter looks for <map:param name="target"></map:param> as
opposed to <map:parameter name="target" value=""/>

Two reasons why I wouldn't like to change this:
1) <map:parameter> is used with elements that can take an arbitrary
   number of parameters depending only on the instantiated class while
   here it is an optional attribute but there's not going to be
   another implementation of <map:redirect-to> at least it is not likely
   to have one configurable by the user.

2) I intent to use it in a setting where there's already a rather deep
   and complex tree and I would be glad to have this be a one-liner
   :-) Otherwise I could have written an action to create and fill a
   new map. Of cause there are other (negative) implications on that
   path so that wouldn't be a bright idea. 

Of cause this is only my opinion and I will support whatever the core
developers decide on this.

Anyway, thanks for the hint.

        Chris.

-- 
C h r i s t i a n       H a u l
[EMAIL PROTECTED]
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08
? build
? sitemap.xsl-patch
Index: src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
retrieving revision 1.18
diff -u -r1.18 sitemap.xsl
--- src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl   
2001/06/21 06:52:56     1.18
+++ src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl   
+2001/06/21 10:27:49
@@ -1163,6 +1163,16 @@
 
       <!-- redirect to a internal resource definition -->
       <xsl:when test="@resource">
+        <xsl:variable name="target">
+          <xsl:call-template name="get-parameter">
+            <xsl:with-param name="parname">target</xsl:with-param>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:if test="string-length($target) > 0 and string($target) != 
+'&quot;&quot;'">
+          map = new HashMap(1);
+          map.put("target","<xsl:value-of select="$target"/>");
+          listOfMaps.add(map);
+        </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, '- ', '__')"/>");

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to