vgritsenko 01/06/27 14:47:14
Modified: src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: cocoon_20_branch sitemap.xsl
Log:
Applied patch from Christian Haul [[EMAIL PROTECTED]]:
- matchers with ' ' and '-' in name works correctly.
- map:parameters for action processed once (before invoking action)
Revision Changes Path
No revision
No revision
1.11.2.13 +15 -14
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.11.2.12
retrieving revision 1.11.2.13
diff -u -r1.11.2.12 -r1.11.2.13
--- sitemap.xsl 2001/06/22 02:54:24 1.11.2.12
+++ sitemap.xsl 2001/06/27 21:47:13 1.11.2.13
@@ -128,7 +128,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.11.2.12 2001/06/22 02:54:24 vgritsenko Exp
$
+ * @version CVS $Id: sitemap.xsl,v 1.11.2.13 2001/06/27 21:47:13 vgritsenko 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"/>";
@@ -148,14 +148,15 @@
<xsl:value-of select="@src"/>
</xsl:variable>
<xsl:if test="XSLTFactoryLoader:isFactory($factory-loader, string($src))">
+ <xsl:variable name="name" select="@name"/>
<xsl:variable name="type" select="translate(@name, '- ', '__')"/>
- <xsl:variable name="default" select="$type = ../@default"/>
+ <xsl:variable name="default" select="@name = ../@default"/>
<xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
private Map <xsl:value-of select="$type"/>Match (<xsl:value-of
select="XSLTFactoryLoader:getParameterSource($factory-loader, string($src),$config)"/>
pattern, Map objectModel, Parameters parameters) {
<xsl:value-of
select="XSLTFactoryLoader:getMethodSource($factory-loader, string($src),$config)"/>
}
<!-- process all map:match elements with a type attribute refering to the
current matcher factory iteration -->
- <xsl:for-each
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:match[@type=$type
or (not(@type) and $default)]">
+ <xsl:for-each
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:match[@type=$name
or (not(@type) and $default)]">
<xsl:call-template name="line-number"/>
<xsl:variable name="matcher-name">
<xsl:call-template name="generate-name">
@@ -419,7 +420,7 @@
try {
eventPipeline = (EventPipeline)this.manager.lookup(Roles.EVENT_PIPELINE);
pipeline = (StreamPipeline)this.manager.lookup(Roles.STREAM_PIPELINE);
- pipeline.setEventPipeline(eventPipeline);
+ pipeline.setEventPipeline(eventPipeline);
result = process (environment, pipeline, eventPipeline, false);
} catch (Exception e) {
getLogger().error("processing of resource failed", e);
@@ -471,7 +472,7 @@
</xsl:call-template>
</xsl:variable>
// method for handling "<xsl:value-of select="@pattern"/>"
- if(<xsl:value-of select="$matcher-type"/>Match<xsl:value-of
select="generate-id(.)"/>(
+ if(<xsl:value-of select="translate($matcher-type, '- ',
'__')"/>Match<xsl:value-of select="generate-id(.)"/>(
environment, pipeline,
eventPipeline,
internalRequest,listOfMaps))
return true;
@@ -622,7 +623,7 @@
<!-- this is the actual code produced -->
// handling "<xsl:value-of select="@pattern"/>"
if ((map = <xsl:value-of select="$matcher-name"/>) != null) {
- getLogger().debug("Matched <xsl:value-of select="$matcher-type"/>
<xsl:value-of select="$matcher-name2"/>");
+ getLogger().debug("Matched <xsl:value-of
select="$matcher-type"/><xsl:text> </xsl:text><xsl:value-of
select="$matcher-name2"/>");
listOfMaps.add (map);
<xsl:apply-templates/>
listOfMaps.remove (listOfMaps.size()-1);
@@ -708,7 +709,7 @@
<!-- this is the actual code produced -->
// method for handling "<xsl:value-of select="@pattern"/>"
- private boolean <xsl:value-of select="$matcher-type"/>Match<xsl:value-of
select="generate-id(.)"/>(
+ private boolean <xsl:value-of select="translate($matcher-type, '- ',
'__')"/>Match<xsl:value-of select="generate-id(.)"/>(
Environment environment, StreamPipeline
pipeline,
EventPipeline eventPipeline,
boolean internalRequest, List listOfMaps)
@@ -897,7 +898,7 @@
}
getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
- <xsl:apply-templates/>
+ <xsl:apply-templates
select="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() !=
'parameter']"/>
listOfMaps.remove(listOfMaps.size()-1);
}
if (redirector.hasRedirected()) {
@@ -955,9 +956,9 @@
<xsl:choose>
<xsl:when test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0'
and local-name() != 'parameter']">
if ((map = <xsl:value-of select="$action-name"/> (redirector, environment,
objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>),
<xsl:value-of select="$component-param"/>)) != null) {
- getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
+ getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
- <xsl:apply-templates/>
+ <xsl:apply-templates
select="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() !=
'parameter']"/>
listOfMaps.remove(listOfMaps.size()-1);
}
</xsl:when>
@@ -1027,9 +1028,9 @@
if (redirector.hasRedirected()) {
return true;
}
- getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
+ getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
- <xsl:apply-templates/>
+ <xsl:apply-templates
select="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and local-name() !=
'parameter']"/>
listOfMaps.remove(listOfMaps.size()-1);
}
if (redirector.hasRedirected()) {
@@ -1179,7 +1180,7 @@
</xsl:variable>
<xsl:if test="string-length($target) > 0 and string($target) !=
'""'">
map = new HashMap(1);
- map.put("target","<xsl:value-of select="$target"/>");
+ map.put("target",substitute(listOfMaps,"<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};
@@ -1518,7 +1519,7 @@
<xsl:template name="generate-name">
<xsl:param name="prefix"/>
<xsl:param name="suffix"/>
- <xsl:value-of select="$prefix"/><xsl:value-of select="$suffix"/>
+ <xsl:value-of select="translate(concat($prefix,$suffix),'- ','__')"/>
</xsl:template>
<!-- These are the usual utility templates for logicsheets -->
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]