You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thomas Balthazar <tb...@emakina.com> on 2002/07/09 18:13:22 UTC

dynamic src for

hello everybody,

i'm a newbie with cocoon, and i would like to quickly test some feature
to eventually use it on a real project.

here is the situation : 

1. the end user click on an hyperlink
(href="http://localhost:8080/cocoon/tba/preview.html")

2. in the sitemap.xmap, the '<map:match pattern="tba/*">' "catches the
click".

3. then the "<map:generate src="docs/samples/tba/tba.xml"/>" file
is processed by "<map:transform src="docs/samples/tba/tba.xsl"/>"
then serialized with "<map:serialize type="html"/>"

ok, this is "easy", the page is displayed and it works fine for me.


now, what i would like to do is to select the "<map:generate src="xxx">"
dynamicly, depending on the link the user clicked on.


what i want to have is :

i generate links for the end user that looks like this :
href="http://localhost:8080/cocoon/tba/preview.html?page=/content/_MY_XM
L_PAGE_1.xml"
href="http://localhost:8080/cocoon/tba/preview.html?page=/content/_MY_XM
L_PAGE_2.xml"
...

if the user clicks on the first link, i would like to have something
like that 
<map:match pattern="tba/*">
	<map:generate src="/content/_MY_XML_PAGE_1.xml"/>
	<map:transform src="docs/samples/tba/redirect.xsl"/>
	<map:serialize type="html"/>
</map:match>

if the user clicks on the second link, i would like to have something
like that 
<map:match pattern="tba/*">
	<map:generate src="/content/_MY_XML_PAGE_2.xml"/>
	<map:transform src="docs/samples/tba/redirect.xsl"/>
	<map:serialize type="html"/>
</map:match>

and so on ...


what i have done is :

1. i generate a link for the end user that looks like this :
href="http://localhost:8080/cocoon/tba/preview.html?page=/content/_MY_XM
L_PAGE_1.xml"

2. in the sitemap.xmap, the '<map:match pattern="tba/*">' "catches the
click".

3. with "<map:generate type="serverpages"
src="docs/samples/tba/redirect.xsp"/>"
i can get the "page" parameter with the "<xsp-request:get-parameter
name="page"/> tag.

4. i can display this parameter for debug with "<map:transform
src="docs/samples/tba/redirect.xsl"/>"
and "<map:serialize type="html"/>"

so what can/must i do with this parameter?
do i have to do something like a "redirect" in the pipeline?
do i have to do it with an "action"?

i hope i was clear ;o)
can you please help me?
thanks in advance.

--
Thomas Balthazar
tba@emakina.com





---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic src for

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
Two solutions (depending on your version):

a) RequestParamAction (2.0.x + 2.1)

 <map:match pattern="tba/*">
    <map:act type="request">
	  <map:parameter name="parameters" value="true"/>
	  <map:generate src="{page}"/>
 	  <map:transform src="docs/samples/tba/redirect.xsl"/>
 	  <map:serialize type="html"/>
    </map:act>
    <!-- else ? -->
 </map:match>

b) InputModules (2.1)

 <map:match pattern="tba/*">
 	<map:generate src="{request:page}"/>
 	<map:transform src="docs/samples/tba/redirect.xsl"/>
 	<map:serialize type="html"/>
 </map:match>

You might want to use ResourceExistsAction to check whether the
provided page exists.

	Chris.

Please follow up summarizing your problem and which suggested solution
/ information worked for you when you consider your problem
solved. Add "SUMMARY: " to the subject line. This will make FAQ
generation and searching the list easier. In addition, it makes
helping you more fun. Thank you.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>