cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: something that bugs me
Date Thu, 01 Nov 2001 15:27:03 GMT
giacomo wrote:
> 
> On Tue, 30 Oct 2001, Stefano Mazzocchi wrote:
> 
> > Take a look at this sitemap fragment (used to generate our own docs):
> >
> >    <map:match pattern="*.html">
> >     <map:aggregate element="site">
> >      <map:part src="cocoon:/book-{1}.xml"/>
> >      <map:part src="cocoon:/body-{1}.xml"/>
> >     </map:aggregate>
> >     <map:transform src="stylesheets/site2xhtml.xsl">
> >        <map:parameter name="use-request-parameters" value="true"/>
> >        <map:parameter name="header" value="graphics/{1}-header.jpg"/>
> >      </map:transform>
> >     <map:serialize/>
> >    </map:match>
> >
> >    <map:match pattern="**/*.html">
> >     <map:aggregate element="site">
> >      <map:part src="cocoon:/{1}/book-{1}/{2}.xml"/>
> >      <map:part src="cocoon:/body-{1}/{2}.xml"/>
> >     </map:aggregate>
> >     <map:transform src="stylesheets/site2xhtml.xsl">
> >        <map:parameter name="use-request-parameters" value="true"/>
> >        <map:parameter name="header"
> > value="{1}/graphics/{2}-header.jpg"/>
> >      </map:transform>
> >     <map:serialize/>
> >    </map:match>
> >
> > they look so much equal it really bugs me there is no simple way to
> > collapse them into one.

I tried, and I couldn't do it.  It has to do with the way the aggregation
calls are made.

If the match to "**/book-*.xml" could be fixed, then it might work.

> >
> > What do you think? I know I'm being overly picky but we should make an
> > effort to create the most clean sitemaps so that people learn from us.
> >
> > Also,
> >
> >    <map:match pattern="**images/*.png">
> >     <map:read src="images/{2}.png" mime-type="image/png"/>
> >    </map:match>
> >
> >    <map:match pattern="**images/*.jpg">
> >     <map:read src="images/{2}.jpg" mime-type="image/jpeg"/>
> >    </map:match>
> >
> >    <map:match pattern="**images/*.gif">
> >     <map:read src="images/{2}.gif" mime-type="image/gif"/>
> >    </map:match>
> >
> > could be condensed into
> >
> >    <map:match pattern="**images/*.*">
> >     <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> >    </map:match>
> >
> > assuming that nothing but images are stored there.
> 
> I'm not sure but the mime-type attribute is not undergoing variable
> replacement so far.

For Jpegs, this would yield the following Mime type that is not
the most correct, but recognized by many clients: "image/jpg".
We would have to change the name of all Jpeg images to use the
".jpeg" extension instead.  That's one reason.

> > Thinking about it, for those like me who can't learn regexp (sorry, but
> > I don't have that mindset), what do you think about adding something
> > like
> >
> >    <map:match pattern="**images/*.{gif|jpg|png}">
> >     <map:read src="images/{2}.gif" mime-type="image/{3}"/>
> >    </map:match>
> 
> You like us to mix wildcard and regex matching?

-1.  If you are going to restrict patterns, regex is very powerful,
and I don't like mixing metaphores here.  In regex, the above
could be written as:

    <map:match pattern=".*images\/.*\.(gif|jpg|png)">
     <map:read src="images/{2}.gif" mime-type="image/{3}"/>
    </map:match>

or something like that.  I'm not a RegExp GURU in the least.  It _is_
very useful when you are validating complex entries like email addresses
and such.

> 
> Giacomo
> 
> >
> > which prevents curly braces from being used in URI, but it could be
> > useful for many to reduce sitemap verbosity by far in many situations.
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org


-- 

"Those who would trade liberty for
 temporary security deserve neither"
                - Benjamin Franklin

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message