cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Timberlake <and...@timberlake.co.za>
Subject default attribute to transformer, reader, SitemapModelComponent, ...
Date Fri, 31 Jan 2003 20:37:28 GMT
I am using Cocoon to create an application which uses stylesheets and
resources to present the content to users. The content is managed by a
database and the content to be returned is determined by part of the
request uri.

The application has a default set of stylesheets and resources (images)
to display content initially. I would like to be able to change the
style for different content based on different stylesheets but to use
the default stylesheets when another stylesheet is not available.

I am finding this very difficult to explain so I will try to go into
detail in this email with examples of the syntax I'd like to use. I need
to know if Cocoon is able to do the following in some other way or if
some changes need to be made?

To simplify the application I'll use the following example. 
This example is trivial and is purely to try to explain the concept, my
application currently has many matchers with many transformations in
which only some may be customised.

The application displays the results of database tables. The application
will generate an xml file of the database table in the same manner for
each table.

<table>
    <row>
        <column_name>value</column_name>
    </row>
</table>

The default set of stylesheets will display the table data in an HTML
table with a default set of colours, images etc.

The pipeline would be as follows

<map:match pattern="/db/*/x.html">
    <map:generate type="serverpages" src="content/tables.xsp">
        <map:parameter name="table" value="{1}"/>
    </map:generate>
    <map:transform src="stylesheets/default/table.xsl"/>
    <map:serialize type="html"/>
</map:match>

I would like to create table specific stylesheets when needed, this
would then become

<map:match pattern="/db/*/x.html">
    <map:generate type="serverpages" src="content/tables.xsp">
        <map:parameter name="table" value="{1}"/>
    </map:generate>
    <map:transform src="stylesheets/{1}/table.xsl"/>
    <map:serialize type="html"/>
</map:match>

But, I would like to fall back on the default stylesheet when a specific
stylesheet does not exist. For this the syntax might be as follows

<map:match pattern="/db/*/x.html">
    <map:generate type="serverpages" src="content/tables.xsp">
        <map:parameter name="table" value="{1}"/>
    </map:generate>
    <map:transform src="stylesheets/{1}/table.xsl"
default="stylesheets/default/table.xsl"/>
    <map:serialize type="html"/>
</map:match>

where default="" would be a fall-back stylesheet that is used should the
src file not be available.

I would also need this for resources such as images such as

<map:read src="images/{1}/header.gif"
default="images/default/header.gif" mime-type="image/gif"/>

I can see uses of this in generators as well.

To repeat the question at the beginning, is there a way to do this with
Cocoon as it currently stands or is this something that would need to be
added?
Does anyone else see this as a useful addition to Cocoon?
Which would be the best way to get this functionality into Cocoon?
	is the default attribute right or should it be something else?
I would be more than prepared to implement such functionality if others
would like it as well.

-- 
Andrew Timberlake <andrew@timberlake.co.za>


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


Mime
View raw message