You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stefano Mazzocchi <st...@apache.org> on 2000/09/28 00:42:49 UTC

[C2] Solving the last details on offline generation

I spent the last hours painting tons of solutions on my whiteboard and I
think I have a pretty elegant solution for all of our problems of
offline generation.

The solution would allow to have the planned functionality of totally
replacing Stylebook, yet the ability to work on the exact same sitemap
you use for dynamic generation, provided that you place some specific
attribute to those linking elements you don't want to execute.

(the attribute is currently xlink:role="dynamic" but I'm thinking about
changing it to a more future-compatible cocoon:follow-link="yes/no",
suggestions/comments are welcome)

The solution requires three changes to Cocoon 2.0a3, and some small
redesign of the view part of the sitemap.


1) Extendend semantic linking capabilities.

It is *NOT* feasible to force users to use XLink semantics for three
reasons:

 a) XLink is honestly too complex for 99% of user needs
 b) XLink is not used by the great majority of languages 
   (XHTML, WML, SMIL, FO) while only one uses it (SVG)
 c) There is no way to inherit attribute semantics and it may not 
    even happen for XMLSchema (no sign of such thing in the latest WD)

So, I extended the XLinkHandler to be able to understand all elements
that have the "src" or "href" attributes as locators or simple links.

NOTE: I *know* this is a hack, but it does its job, it's easy and it's
the only way we can work until all the languages adopt XLink so, until
XLink is *really* used in real life, we'll stick with this solution
which doesn't require people to rethink something so basic as simple
hyperlinking.


2) positional labels for views

Currently, you can define a view by attaching it to a particular label.
While this is very easy and not so verbose, there is no way of defining
a view that must exit right before the serializer, unless you manually
placed the label on every pipeline.

Since I want the sitemap writers to ignore the command line interface as
much as possible, the above is too expensive in terms of maintanance and
knowledge.

This feature is required by 'links' view that needs to exit from right
before the serializer in order to receive all the linked content of the
page

Example: the welcome.html page doesn't include the images/cocoon.gif
image because the information is not contained into the samples.xml
page, but in the stylesheet. Hyperlinking is also used for content
aggregation and when this happens (images or binary resources) they are
normally found in stylesheets rather than content.

So, for a general resource we have

 generator --+-- transformer ... transformer --+-- serializer
             |                                 |
           first                              last

I proposed to add a "positional label" for views as such

  <map:view name="content" from-position="first">
   <map:serialize type="xml"/>
  </map:view>

  <map:view name="links" from-position="last">
   <map:serialize type="links"/>
  </map:view>

and to modify the current attribute "generate-from" to "from-label" as
such

  <map:view name="schema" from-label="content">
   <map:transform type="schema"/>
   <map:serialize type="xml"/>
  </map:view>


3) Implicit link translation

Link translation cannot be a view of a resource unless each resource
clones it's own pipeline ending in the view.

Example:

     g --+-- t1 --+-- t2 --+-- t3 --+-- s
                  |
                  +-- LT --+-- t2 --+-- t3 --+-- s

where
  
  g = generator
  t# = transformer 
  s = serializer
  LT = link translator

this has a complexity linear with the number of pipelines and for this
reason is too expensive.

But it may be shown that LT must always be the last transformer in the
chain, so we might use the positional labeling we just introduced to do
something like

     g --+-- t1 --+-- t2 --+-- t3 --+-- s
                                    |
                                    +-- LT --+-- s

which is indeed less verbose, but requires a different view for each
serializer. True, this is less than linear with the pipelines but it's
not elegant.

It must also be noted that link translator is not a "real" transformer
in the sense that web clients DO NOT have a way to submit the link
tranlating list (which is passed only at command line thru internal
Cocoon API and doesn't hook to the Servlet API for security reasons).

So, I propose to hide the LT totally inside the sitemap mechanics as
such

 1) if the objectModel contains a non-null object to the key "links",
the LinkTranslator transformer is called right before the serializer
 2) otherwise everything happens like it was before

Comments, questions?

Giacomo, since you are the one that knows best the sitemap internals,
would you give me a hand implementing these changes?

--
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------


Re: [C2] Solving the last details on offline generation

Posted by Giacomo Pati <Gi...@pwr.ch>.
Stefano Mazzocchi wrote:
> 
<snip/>> 
> Comments, questions?
> 
> Giacomo, since you are the one that knows best the sitemap internals,
> would you give me a hand implementing these changes?

Yes, of course, let me think about it and I get it done within the next
few hours or tomorrow :)

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1  856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1  856 2201
Hintereichenstrasse 7                     Mobil: +41 (0)78 759 7703
CH-8166 Niederweningen                    Mailto:Giacomo.Pati@pwr.ch
                                          Web:   http://www.pwr.ch

Re: [C2] Solving the last details on offline generation

Posted by Stefano Mazzocchi <st...@apache.org>.
Giacomo Pati wrote:
> 
> Stefano Mazzocchi wrote:
> >
> > I spent the last hours painting tons of solutions on my whiteboard and I
> > think I have a pretty elegant solution for all of our problems of
> > offline generation.
> >
> > The solution would allow to have the planned functionality of totally
> > replacing Stylebook, yet the ability to work on the exact same sitemap
> > you use for dynamic generation, provided that you place some specific
> > attribute to those linking elements you don't want to execute.
> >
> > (the attribute is currently xlink:role="dynamic" but I'm thinking about
> > changing it to a more future-compatible cocoon:follow-link="yes/no",
> > suggestions/comments are welcome)
> >
> > The solution requires three changes to Cocoon 2.0a3, and some small
> > redesign of the view part of the sitemap.
> >
> > 1) Extendend semantic linking capabilities.
> >
> > It is *NOT* feasible to force users to use XLink semantics for three
> > reasons:
> >
> >  a) XLink is honestly too complex for 99% of user needs
> >  b) XLink is not used by the great majority of languages
> >    (XHTML, WML, SMIL, FO) while only one uses it (SVG)
> >  c) There is no way to inherit attribute semantics and it may not
> >     even happen for XMLSchema (no sign of such thing in the latest WD)
> >
> > So, I extended the XLinkHandler to be able to understand all elements
> > that have the "src" or "href" attributes as locators or simple links.
> 
> Ok.
> 
> > NOTE: I *know* this is a hack, but it does its job, it's easy and it's
> > the only way we can work until all the languages adopt XLink so, until
> > XLink is *really* used in real life, we'll stick with this solution
> > which doesn't require people to rethink something so basic as simple
> > hyperlinking.
> >
> > 2) positional labels for views
> >
> > Currently, you can define a view by attaching it to a particular label.
> > While this is very easy and not so verbose, there is no way of defining
> > a view that must exit right before the serializer, unless you manually
> > placed the label on every pipeline.
> >
> > Since I want the sitemap writers to ignore the command line interface as
> > much as possible, the above is too expensive in terms of maintanance and
> > knowledge.
> >
> > This feature is required by 'links' view that needs to exit from right
> > before the serializer in order to receive all the linked content of the
> > page
> >
> > Example: the welcome.html page doesn't include the images/cocoon.gif
> > image because the information is not contained into the samples.xml
> > page, but in the stylesheet. Hyperlinking is also used for content
> > aggregation and when this happens (images or binary resources) they are
> > normally found in stylesheets rather than content.
> >
> > So, for a general resource we have
> >
> >  generator --+-- transformer ... transformer --+-- serializer
> >              |                                 |
> >            first                              last
> >
> > I proposed to add a "positional label" for views as such
> >
> >   <map:view name="content" from-position="first">
> >    <map:serialize type="xml"/>
> >   </map:view>
> >
> >   <map:view name="links" from-position="last">
> >    <map:serialize type="links"/>
> >   </map:view>
> >
> > and to modify the current attribute "generate-from" to "from-label" as
> > such
> >
> >   <map:view name="schema" from-label="content">
> >    <map:transform type="schema"/>
> >    <map:serialize type="xml"/>
> >   </map:view>
> 
> Ok. This is implemented in a 5 second... done.
> 
> > 3) Implicit link translation
> >
> > Link translation cannot be a view of a resource unless each resource
> > clones it's own pipeline ending in the view.
> >
> > Example:
> >
> >      g --+-- t1 --+-- t2 --+-- t3 --+-- s
> >                   |
> >                   +-- LT --+-- t2 --+-- t3 --+-- s
> >
> > where
> >
> >   g = generator
> >   t# = transformer
> >   s = serializer
> >   LT = link translator
> >
> > this has a complexity linear with the number of pipelines and for this
> > reason is too expensive.
> >
> > But it may be shown that LT must always be the last transformer in the
> > chain, so we might use the positional labeling we just introduced to do
> > something like
> >
> >      g --+-- t1 --+-- t2 --+-- t3 --+-- s
> >                                     |
> >                                     +-- LT --+-- s
> >
> > which is indeed less verbose, but requires a different view for each
> > serializer. True, this is less than linear with the pipelines but it's
> > not elegant.
> >
> > It must also be noted that link translator is not a "real" transformer
> > in the sense that web clients DO NOT have a way to submit the link
> > tranlating list (which is passed only at command line thru internal
> > Cocoon API and doesn't hook to the Servlet API for security reasons).
> >
> > So, I propose to hide the LT totally inside the sitemap mechanics as
> > such
> >
> >  1) if the objectModel contains a non-null object to the key "links",
> > the LinkTranslator transformer is called right before the serializer
> >  2) otherwise everything happens like it was before
> 
> Ok, I think you mean the following:
> 
>    if (environment.getObjectModel().get("links") != null) {
>       // additionaly plug in the
> org.apache.cocoon.sitemap.LinkTransformer
>    }
> 
> If this is what you want, put in the LinkTransformer and I'll commit the
> changed sitemap.xsl.

Ok
 
> >
> > Comments, questions?
> >
> > Giacomo, since you are the one that knows best the sitemap internals,
> > would you give me a hand implementing these changes?
> 
> BTW: I still don't like passing the environment instead of the
> objectModel to the sitemap component.
> Your comments please :)

Coming up next.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: [C2] Solving the last details on offline generation

Posted by Giacomo Pati <Gi...@pwr.ch>.
Stefano Mazzocchi wrote:
> 
> I spent the last hours painting tons of solutions on my whiteboard and I
> think I have a pretty elegant solution for all of our problems of
> offline generation.
> 
> The solution would allow to have the planned functionality of totally
> replacing Stylebook, yet the ability to work on the exact same sitemap
> you use for dynamic generation, provided that you place some specific
> attribute to those linking elements you don't want to execute.
> 
> (the attribute is currently xlink:role="dynamic" but I'm thinking about
> changing it to a more future-compatible cocoon:follow-link="yes/no",
> suggestions/comments are welcome)
> 
> The solution requires three changes to Cocoon 2.0a3, and some small
> redesign of the view part of the sitemap.
> 
> 1) Extendend semantic linking capabilities.
> 
> It is *NOT* feasible to force users to use XLink semantics for three
> reasons:
> 
>  a) XLink is honestly too complex for 99% of user needs
>  b) XLink is not used by the great majority of languages
>    (XHTML, WML, SMIL, FO) while only one uses it (SVG)
>  c) There is no way to inherit attribute semantics and it may not
>     even happen for XMLSchema (no sign of such thing in the latest WD)
> 
> So, I extended the XLinkHandler to be able to understand all elements
> that have the "src" or "href" attributes as locators or simple links.

Ok.

> NOTE: I *know* this is a hack, but it does its job, it's easy and it's
> the only way we can work until all the languages adopt XLink so, until
> XLink is *really* used in real life, we'll stick with this solution
> which doesn't require people to rethink something so basic as simple
> hyperlinking.
> 
> 2) positional labels for views
> 
> Currently, you can define a view by attaching it to a particular label.
> While this is very easy and not so verbose, there is no way of defining
> a view that must exit right before the serializer, unless you manually
> placed the label on every pipeline.
> 
> Since I want the sitemap writers to ignore the command line interface as
> much as possible, the above is too expensive in terms of maintanance and
> knowledge.
> 
> This feature is required by 'links' view that needs to exit from right
> before the serializer in order to receive all the linked content of the
> page
> 
> Example: the welcome.html page doesn't include the images/cocoon.gif
> image because the information is not contained into the samples.xml
> page, but in the stylesheet. Hyperlinking is also used for content
> aggregation and when this happens (images or binary resources) they are
> normally found in stylesheets rather than content.
> 
> So, for a general resource we have
> 
>  generator --+-- transformer ... transformer --+-- serializer
>              |                                 |
>            first                              last
> 
> I proposed to add a "positional label" for views as such
> 
>   <map:view name="content" from-position="first">
>    <map:serialize type="xml"/>
>   </map:view>
> 
>   <map:view name="links" from-position="last">
>    <map:serialize type="links"/>
>   </map:view>
> 
> and to modify the current attribute "generate-from" to "from-label" as
> such
> 
>   <map:view name="schema" from-label="content">
>    <map:transform type="schema"/>
>    <map:serialize type="xml"/>
>   </map:view>

Ok. This is implemented in a 5 second... done.

> 3) Implicit link translation
> 
> Link translation cannot be a view of a resource unless each resource
> clones it's own pipeline ending in the view.
> 
> Example:
> 
>      g --+-- t1 --+-- t2 --+-- t3 --+-- s
>                   |
>                   +-- LT --+-- t2 --+-- t3 --+-- s
> 
> where
> 
>   g = generator
>   t# = transformer
>   s = serializer
>   LT = link translator
> 
> this has a complexity linear with the number of pipelines and for this
> reason is too expensive.
> 
> But it may be shown that LT must always be the last transformer in the
> chain, so we might use the positional labeling we just introduced to do
> something like
> 
>      g --+-- t1 --+-- t2 --+-- t3 --+-- s
>                                     |
>                                     +-- LT --+-- s
> 
> which is indeed less verbose, but requires a different view for each
> serializer. True, this is less than linear with the pipelines but it's
> not elegant.
> 
> It must also be noted that link translator is not a "real" transformer
> in the sense that web clients DO NOT have a way to submit the link
> tranlating list (which is passed only at command line thru internal
> Cocoon API and doesn't hook to the Servlet API for security reasons).
> 
> So, I propose to hide the LT totally inside the sitemap mechanics as
> such
> 
>  1) if the objectModel contains a non-null object to the key "links",
> the LinkTranslator transformer is called right before the serializer
>  2) otherwise everything happens like it was before

Ok, I think you mean the following:

   if (environment.getObjectModel().get("links") != null) {
      // additionaly plug in the
org.apache.cocoon.sitemap.LinkTransformer
   }

If this is what you want, put in the LinkTransformer and I'll commit the
changed sitemap.xsl.

> 
> Comments, questions?
> 
> Giacomo, since you are the one that knows best the sitemap internals,
> would you give me a hand implementing these changes?

BTW: I still don't like passing the environment instead of the
objectModel to the sitemap component.
Your comments please :)

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1  856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1  856 2201
Hintereichenstrasse 7                     Mobil: +41 (0)78 759 7703
CH-8166 Niederweningen                    Mailto:Giacomo.Pati@pwr.ch
                                          Web:   http://www.pwr.ch

Re: [C2] Solving the last details on offline generation

Posted by Stefano Mazzocchi <st...@apache.org>.
Giacomo Pati wrote:
> 
> Stefano Mazzocchi wrote:
> >
> <snip>
> >
> > So, for a general resource we have
> >
> >  generator --+-- transformer ... transformer --+-- serializer
> >              |                                 |
> >            first                              last
> >
> > I proposed to add a "positional label" for views as such
> >
> >   <map:view name="content" from-position="first">
> >    <map:serialize type="xml"/>
> >   </map:view>
> >
> >   <map:view name="links" from-position="last">
> >    <map:serialize type="links"/>
> >   </map:view>
> >
> > and to modify the current attribute "generate-from" to "from-label" as
> > such
> >
> >   <map:view name="schema" from-label="content">
> >    <map:transform type="schema"/>
> >    <map:serialize type="xml"/>
> >   </map:view>
> 
> Ok, ist in the CVS. See if it meets your needs.

You're my savior dude :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: [C2] Solving the last details on offline generation

Posted by Giacomo Pati <Gi...@pwr.ch>.
Stefano Mazzocchi wrote:
>
<snip> 
>
> So, for a general resource we have
> 
>  generator --+-- transformer ... transformer --+-- serializer
>              |                                 |
>            first                              last
> 
> I proposed to add a "positional label" for views as such
> 
>   <map:view name="content" from-position="first">
>    <map:serialize type="xml"/>
>   </map:view>
> 
>   <map:view name="links" from-position="last">
>    <map:serialize type="links"/>
>   </map:view>
> 
> and to modify the current attribute "generate-from" to "from-label" as
> such
> 
>   <map:view name="schema" from-label="content">
>    <map:transform type="schema"/>
>    <map:serialize type="xml"/>
>   </map:view>

Ok, ist in the CVS. See if it meets your needs.

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1  856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1  856 2201
Hintereichenstrasse 7                     Mobil: +41 (0)78 759 7703
CH-8166 Niederweningen                    Mailto:Giacomo.Pati@pwr.ch
                                          Web:   http://www.pwr.ch