cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@dff.st>
Subject Re: [Announcement] sitemap variables
Date Thu, 10 Oct 2002 02:09:01 GMT
On Wed, 2002-10-09 at 23:06, Antonio Gallardo Rivera wrote:
> Why try to reinvent the wheel?

did you guys get something wrong here?

> 
> We already have XPath. Why use it? Because its like all computer related thing 
> teached us for years. Everybody know that ".." means parent.

but the question is - what means child?

"../" is well known in xpath as well as in filesystems for being "one
level up". So what would be the syntax for "one level down" then? AFAICS
there is none for a filesystem. the closest would be "/*/*/*/1" as xpath
syntax. but actually the (virtual) tree of matcher/action results is

level1
  +-1
  +-2
  |
  +-level2
      +-1
      +-2
      +-3
      |


for something like this:

  <map:match pattern="**.*">
     <map:match pattern="**/*.*">
      ...

so adressing the results absolute would be

  /level1/1
  /level1/level2/2

which could be written as /*/1 and /*/*/1 or (since we always start with
level1) to /1 and /*/1. which in turn could be reduced to /1 and //2.


admittingly {////1} is not very expressive but should be not too hard to
grasp. as I said: it was my first guess... and I asked for comments. but
please be a little more constructive then "it's really poor". next time
please come up with a better syntax ;)

I must admit that I am not really in favor of Ilya's proposal because it
will virtually flatten the variable tree and will give problems with
variable name clashes. as well is the {bla:something} syntax already
used by the InputModules.

but I also not very clear myself it is really necessary or useful. an
example would be:

  <map:match pattern="**.html">
     <map:act type="..">
        <map:act type="..">
          <map:generate src="{//fromfirstaction"/>
        </map:act>
        <map:generate src="{//fromfirstaction"/>

the absolute refering of the result of the first action would save you
from counting the levels for each position where you want to use the
variable. 

  <map:match pattern="**.html">
     <map:act type="..">
        <map:act type="..">
          <map:generate src="{../fromfirstaction"/>
        </map:act>
        <map:generate src="{fromfirstaction"/>

and as soon as you surround a subtree of the pipeline (insert another
act e.g.) you currently have to add a "../" on each use of a variable
from the parent tree.

cheers
--
Torsten


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


Mime
View raw message