Terry Brick schrieb:
Thanks for the link, that helped me understand the basics of the 'path' structure the variables
are referring to.
I'm trying hard to understand this before posting such basic questions to the list... I really
am... but I'm still have some trouble grasping this and have spent too much time on it. However,
it doesn't really address a few other elements to my question.



a) For example, i understand that if "*.xml" is matched, then "{1}" refers to the text matched by the first wildcard. So, this implies a 1-based index (as opposed to 0-based). So then what the heck is {0}?

it normally specifies the whole matched 'expression'; e.g. for URI matchers it's the URI that matched the pattern you specified.


b) The example I put in my first email also had "{../../locale}".  This is also not 
covered in
this document.  My assumption is that it is reference to a URL parameter that has been 
submitted?

c) And finally, either I don't understand one example in the Wiki document or there is 
a
mistake....
It states, "So if you insert a new level e.g. by calling an action or a matcher. You 
have to refer
the previous level to get the same value from the Matcher."
... it then gives this example ...
 <map:match pattern="images/*.gif">
    <map:act type="resource-exists">
      <map:parameter name="url" value="resources/images/{1}.gif">
      <!-- new level -->
      <map:read src="resources/images/{../1}.gif" mime-type="images/gif"/>
    </map:act>
 </map:match>
 ...

Conceptually (not literally) shouldn't it be something like?....
 <map:match pattern="images/*.gif">
    {1}
    <!-- new level -->
    <map:act>
      {../1}
      <!-- new level -->
      <map:read>
         {../../1}
      </map:read>
    </map:act>
 </map:match>

the parameter syntax is really one of the weakest and ugliest points in sitemap syntax, even more when used in conjunction with resources (which were originally supposed to be used differently). but kind of logial, though ;-)


the basic concept behind the stuff is that matchers, actions, selectors, etc. can return 'parameters' to the sitemap. since you can nest the stuff (e.g. <map:act> within <map:match> or <map:act> within <map:act>) there are also nested 'scopes' so that one sitemap component doesn't overwrite 'parameters' returned from another sitemap component. it also enables you to unambiguously (and certainly unreadably ;-) reference those 'parameters'.

the only caveat here is the <map:act> and its parameters. the way it's written may fool you into thinking that its <map:param> is part of the <map:act>'s scope, but it isn't. that's purely visual and the reason is easier parsing.

instead of:

<map:act type="resource-exists">
        <map:parameter name="url" value="resources/images/{1}.gif">
        ...
</map:act>

think/read:

<map:act type="resource-exists" url="resources/images/{1}.gif">
        ...
</map:act>

because that's the way it actually works internally.




--- Antonio Gallardo <[EMAIL PROTECTED]> wrote:

Hi:

See http://wiki.apache.org/cocoon/SitemapVariableSubstitution

Best Regards,

Antonio Gallardo

Terry Brick dijo:

Hi,
I'm sure I'm being overlooking the obvious, but I just spent about 2 hours
searching for
documentation on this stuff and I just can figure it out.  It's
frustrating because I know when I
first started playing with Cocoon, I saw some doc on this (although I
didn't understand it at that
time either), but now I can't find it.
The following XML is extracted from the i18n example's sitemap.xmap.
Could somebody please tell
me what the paths are referring to?  What data they're working on, etc?
THanks!


<map:resources> <!-- This resource is used to create a composite page from menu and content --> <map:resource name="composite"> <map:aggregate element="root"> <map:part src="cocoon:/menu/{../0}"/> <map:part src="cocoon:/content/{../0}" label="content"/> </map:aggregate> <map:transform type="xalan" src="simple2page.xsl"> <map:parameter name="page" value="{../0}"/> <map:parameter name="locale" value="{../../locale}"/> </map:transform> <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl"> <map:parameter name="contextPath" value="{request:contextPath}"/> </map:transform> <map:serialize type="html"/> </map:resource> </map:resources>


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







__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/


---------------------------------------------------------------------
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