On Thu, 29 Nov 2001, giacomo wrote: > On Wed, 28 Nov 2001, Christian Haul wrote: > > > Team, > > > > please have a look at this from cocoon-users. > > > > Chris. > > > Thanks Cris, > > > > Again you saved me, man. Thanks. > > You're welcome :-) > > > Approach with <map:parameter name="target" value="welcome"/> generates > code > > in wrong place, which cause compilation error of sitemap. So I guess it > > could be treated as a BUG. > > I tend to disagree here. There's no language element that allows > setting of sitemap parameters er, variables. They are usually the > result of sitemap components execution. More in particular, from those > components that are used to determine the actual pipeline from the > given fragments (matchers, actions; selectors return only true / > false). > > <map:parameter/> is used to do runtime configuration of those > components. <map:redirect-to/> is no component but a control > statement and thus doesn't take runtime configuration. > > I agree, though, that @target is probably not as clean as possible. A > better solution would be, to introduce some construct to set those > variables without the need of an action, like > > <map:variables> > <map:parameter name="foo" value="xyz"/> > <map:parameter name="bar" value="uvw"/> > </map:variables>
I'm not very happy with this. What is the reason to have those variables and how and why should they be used? I know if we block such a request someone will write a Matcher that spans everything that needs access to variables like <map:match type="create-a-root-map"> <map:parameter name="bar" value="uvw"/> <map:parameter name="foo" value="xyz"/> <map:macth patter="foo"> <map:generate src="{../foo}/bar.xml"/> ... This is IMO a misuse of the Matcher concept, but yes I'm sure someone will do it sometimes. Giacomo > > that is translated by the following in sitemap.xsl (not tested!): > > <xsl:template match="map:variables"> > Map map = new HashMap(<xsl:value-of select="count(map:parameter)"/>); > <!-- actually, here we could as well use for-each since only > map:parameter would be allowed here. OTOH a common advice is > not to use for-each for performance reasons. See below for > alternative solution. > --> > <xsl:apply-templates/> > listOfMaps.add(map); > this.dumpParameters(); > </xsl:template> > > <xsl:template match="map:variables/map:parameter" priority="2"> > map.put("<xsl:value-of select="@name"/>", substitute(listOfMaps, > "<xsl:value-of select="@value"/>")); > </xsl:template> > > > Or > > <xsl:template match="map:variables"> > Map map = new HashMap(<xsl:value-of select="count(map:parameter)"/>); > <xsl:for-each select="map:parameter"> > map.put("<xsl:value-of select="@name"/>", substitute(listOfMaps, > "<xsl:value-of select="@value"/>")); > </xsl:for-each> > listOfMaps.add(map); > this.dumpParameters(); > </xsl:template> > > > Team, shall we have a vote on this? > > Chris. > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]