On Thu, 2006-02-09 at 21:56 +0000, [EMAIL PROTECTED] wrote:
> Author: chestnut
> Date: Thu Feb  9 13:56:04 2006
> New Revision: 376448
> 
> URL: http://svn.apache.org/viewcvs?rev=376448&view=rev
> Log:
> removal of fallback:// from external relaxng schemas, 
> while still utilizing fallback functionality by specifying 
> the publication the schema is being used in

Hi Doug,

Thanks for fixing this.
I just wanted to ask how this relates to the following pipeline in
global-sitemap.xmap:

<!-- RNG fallback requests -->
<map:match pattern="fallback/**.rng">
  <map:generate src="fallback://{1}.rng"/>
    <map:transform src="lenya/xslt/util/translate-rng-includes.xsl">
       <map:parameter name="contextprefix"
value="{request:contextPath}"/>
    </map:transform>
  <map:serialize type="xml"/>
</map:match>

Is this pipeline now obsolete?
It uses translate-rng-includes.xsl to replace the schema include. Is
this xsl still necessary now?

Josias


> 
> Added:
>     lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl   (with 
> props)
> Modified:
>     
> lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
>     lenya/trunk/src/webapp/lenya/module-resources.xmap
> 
> Modified: 
> lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
> URL: 
> http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java?rev=376448&r1=376447&r2=376448&view=diff
> ==============================================================================
> --- 
> lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
>  (original)
> +++ 
> lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
>  Thu Feb  9 13:56:04 2006
> @@ -27,6 +27,7 @@
>  import org.apache.cocoon.components.modules.input.AbstractInputModule;
>  import org.apache.cocoon.environment.ObjectModelHelper;
>  import org.apache.cocoon.environment.Request;
> +import org.apache.lenya.cms.publication.Publication;
>  import org.apache.lenya.cms.publication.Document;
>  import org.apache.lenya.cms.publication.DocumentIdentityMap;
>  import org.apache.lenya.cms.publication.ResourceType;
> @@ -57,6 +58,7 @@
>              Session session = RepositoryUtil.getSession(request, 
> getLogger());
>  
>              ResourceType resourceType;
> +            Publication pub = null;
>              String attribute;
>  
>              String[] steps = name.split(":");
> @@ -68,6 +70,7 @@
>                  String webappUrl = ServletHelper.getWebappURI(request);
>                  Document document = docFactory.getFromURL(webappUrl);
>                  resourceType = document.getResourceType();
> +                pub = document.getPublication();
>              } else {
>                  attribute = steps[1];
>                  String resourceTypeName = steps[0];
> @@ -89,8 +92,8 @@
>                  value = resourceType.getSchema().getURI();
>              } else if (attribute.equals(HTTP_SCHEMA_URI)) {
>                  String uri = resourceType.getSchema().getURI();
> -                String path = uri.substring("fallback://".length());
> -                value = request.getContextPath() + "/fallback/" + path;
> +                String path = uri.substring(uri.indexOf("/schemas"));
> +                value = request.getContextPath() + "/" + pub.getId() + 
> "/modules/" + resourceType.getName() + path;
>              } else {
>                  throw new ConfigurationException("Attribute [" + name + "] 
> not supported!");
>              }
> 
> Modified: lenya/trunk/src/webapp/lenya/module-resources.xmap
> URL: 
> http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/module-resources.xmap?rev=376448&r1=376447&r2=376448&view=diff
> ==============================================================================
> --- lenya/trunk/src/webapp/lenya/module-resources.xmap (original)
> +++ lenya/trunk/src/webapp/lenya/module-resources.xmap Thu Feb  9 13:56:04 
> 2006
> @@ -20,6 +20,13 @@
>  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
>  
>    <map:pipelines>
> +    <map:pipeline internal-only="true">
> +      <map:match pattern="*/**.*">
> +        <map:match type="regexp" pattern="(.*\.)(rng)$"> 
> +          <map:read 
> src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}" 
> mime-type="application/xml"/>
> +        </map:match> 
> +      </map:match>
> +    </map:pipeline>
>      <map:pipeline>
>        
>        <!-- matches modules/*/**.css -->
> @@ -49,9 +56,13 @@
>          <map:match type="regexp" pattern="(.*\.)(xml)$"> 
>            <map:read 
> src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}" 
> mime-type="text/xml"/>
>          </map:match>        
> -        <map:match type="regexp" pattern="(.*\.)(rng)$"> 
> -          <map:read 
> src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}" 
> mime-type="application/xml"/>
> -        </map:match> 
> +        <map:match type="regexp" pattern="(.*\.)(rng)$">
> +          <map:generate 
> src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}"/>
> +          <map:transform 
> src="fallback://lenya/xslt/resources/external-relax.xsl">
> +            <map:parameter name="publicationid" 
> value="{page-envelope:publication-id}"/>
> +          </map:transform>
> +          <map:serialize type="xml"/>
> +        </map:match>
>          <map:match type="regexp" 
> pattern="(.*\.)(jpg|JPG|Jpg|jpeg|Jpeg|JPEG)$"> 
>            <map:read 
> src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}" 
> mime-type="image/jpeg" />
>          </map:match> 
> 
> Added: lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl
> URL: 
> http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl?rev=376448&view=auto
> ==============================================================================
> --- lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl (added)
> +++ lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl Thu Feb  9 
> 13:56:04 2006
> @@ -0,0 +1,40 @@
> +<?xml version="1.0" encoding="UTF-8" ?>
> +<!--
> +  Copyright 1999-2004 The Apache Software Foundation
> +
> +  Licensed under the Apache License, Version 2.0 (the "License");
> +  you may not use this file except in compliance with the License.
> +  You may obtain a copy of the License at
> +
> +      http://www.apache.org/licenses/LICENSE-2.0
> +
> +  Unless required by applicable law or agreed to in writing, software
> +  distributed under the License is distributed on an "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +  See the License for the specific language governing permissions and
> +  limitations under the License.
> +-->
> +
> +<xsl:stylesheet version="1.0"
> +    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> +    >
> +
> +  <xsl:param name="publicationid" />
> +  
> +
> +  <xsl:template match="@href[starts-with(.,'fallback')]">
> +    <xsl:variable name="nofallback" 
> select="substring-after(.,'fallback://lenya/modules/')"/>
> +    <xsl:variable name="restype" 
> select="substring-before($nofallback,'/resources')"/>
> +    <xsl:variable name="resource" 
> select="substring-after($nofallback,'resources/')"/>
> +    <xsl:attribute name="href">
> +      <xsl:value-of select="concat('/' , $publicationid, '/modules/' , 
> $restype, '/', $resource)"/>
> +    </xsl:attribute>
> +  </xsl:template>
> +  
> +  <xsl:template match="@*|node()">
> +    <xsl:copy>
> +      <xsl:apply-templates select="@*|node()"/>
> +    </xsl:copy>
> +  </xsl:template>
> +  
> +</xsl:stylesheet> 
> 
> Propchange: lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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

Reply via email to