Alex
IMO it's easier is you put your coplet inside only one match, because you
will not have to use the portal-object-model action.
Therefore, your match will become
<!-- <resource>.<style>.coplet -->
<map:match pattern="*.*.coplet">
<map:generate src="{1}.resource">
<map:trasform src="{1}2{2}.xsl">
<map:parameter name="news-id"
value="{coplet:parameters/news-id}"/>
<map:trasform src="{2}-links.xsl"/>
<map:serialize type="xml"/>
</map:match>
Hope that will be useful.
Laurent
> -----Message d'origine-----
> De�: Alex Romayev [mailto:[EMAIL PROTECTED]
> Envoy�: jeudi 22 janvier 2004 15:32
> ��: [EMAIL PROTECTED]
> Objet�: RE: [portal] Linking to portal pages
>
> Laurent,
>
> Let me explain what I'm trying to achieve. I am
> porting my site from the old portal-fw to the new
> portal engine. I have implemented my coplets in two
> steps:
>
> 1. Match on *.<style>.coplet, for example
> <map:match *.related.coplet>
> <map:generate src="{1}.resource">
> <map:trasform src="related-links.xsl"/>
> <map:serialize type="xml"/>
> </map:match>
>
> This allows me to appy the same style to multiple
> sources.
>
> 2. Match on *.resource and generate xml expected for
> the style (notice that I'm pulling my news-id from the
> request):
> <map:match related-news.resource>
> <map:generate src="news.xml">
> <map:trasform src="news2related.xsl">
> <map:parameter name="news-id"
> value="{request-param:news-id}"/>
> <map:serialize type="xml"/>
> </map:match>
>
> Does this make sense?
>
> Thanks,
> -Alex
>
> --- Laurent Trillaud <[EMAIL PROTECTED]> wrote:
> > Alex
> > I'm not sure to understand what your problem is.
> > When you declare a coplet attribute in the
> > copletinstancedata dir, it's like
> > a local variable where the scope is the coplet
> > itself.
> > Laurent
> >
> > > -----Message d'origine-----
> > > De : Alex Romayev [mailto:[EMAIL PROTECTED]
> > > Envoyi : mardi 20 janvier 2004 17:08
> > > @ : [EMAIL PROTECTED]
> > > Objet : RE: [portal] Linking to portal pages
> > >
> > > OK, I'm almost there!
> > >
> > > The reason for the error was that I was using
> > > "parameters/news-id" rather than
> > "attributes/news-id".
> > >
> > > Now one question: easier to show with an example:
> > >
> > > This works:
> > >
> > > <map:match pattern="news-item.portlet">
> > > <map:generate src="news.xml"/>
> > > <map:transform src="filter-news-item.xsl">
> > > <map:parameter name="news-id"
> > > value="{coplet:attribute/news-id}/>
> > > </map:transform>
> > > <map:transform src="news-item2html.xsl"/>
> > > <map:serialize type="xml/>
> > > </map:match>
> > >
> > > However, this does't (notice, that the attribute
> > is
> > > being used by another pipeline, which is called by
> > the
> > > coplet pipeline):
> > >
> > > <map:match pattern="news-item.portlet">
> > > <map:generate src="cocoon:/news-item.resouce"/>
> > > <map:transform src="news-item2html.xsl"/>
> > > <map:serialize type="xml/>
> > > </map:match>
> > >
> > > <map:match pattern="news-item.resource">
> > > <map:generate src="news.xml"/>
> > > <map:transform src="filter-news-item.xsl">
> > > <map:parameter name="news-id"
> > > value="{coplet:attribute/news-id}/>
> > > </map:transform>
> > > <map:serialize type="xml/>
> > > </map:match>
> > >
> > > Any ideas?
> > >
> > > Thanks,
> > > -Alex
> > >
> > > --- Alex Romayev <[EMAIL PROTECTED]> wrote:
> > > > Hi Laurent,
> > > >
> > > > Thanks again for your help,
> > > > -Alex
> > > >
> > > > ==========================================
> > > > copletinstancedata/portal.xml:
> > > >
> > > > The calling coplet:
> > > >
> > > > <coplet-instance-data id="news-summary-1"
> > > > name="standard">
> > > > <coplet-data>news-summary</coplet-data>
> > > > </coplet-instance-data>
> > > >
> > > > The coplet being called, requires news-id
> > parameter
> > > > (no default):
> > > > <coplet-instance-data id="news-item-1"
> > > > name="standard">
> > > > <coplet-data>news-item</coplet-data>
> > > > <attribute>
> > > > <name>news-id</name>
> > > > <value
> > > >
> > >
> >
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > xsi:type="java:java.lang.String"></value>
> > > > </attribute>
> > > > </coplet-instance-data>
> > > >
> > > > ======================================
> > > > portlets.xmap:
> > > >
> > > > <map:match pattern="home/news-summary.portlet">
> > > > <map:generate
> > > > src="cocoon://site/home/news-summary.resource"/>
> > > > <map:transform
> > > >
> > >
> >
> src="portal/styles/html/portlets/home/news-summary.xsl">
> > > > <map:parameter name="use-request-parameters"
> > > > value="true"/>
> > > > </map:transform>
> > > > <map:act type="locale">
> > > > <map:transform type="i18n">
> > > > <map:parameter name="locale"
> > > > value="{locale}"/>
> > > > </map:transform>
> > > > </map:act>
> > > > <map:transform type="portal-coplet" />
> > > > <map:serialize type="xml"/>
> > > > </map:match>
> > > >
> > > >
> > > > <map:match
> > pattern="news/news-news-item.portlet">
> > > > <map:aggregate element="module">
> > > > <map:part
> > > > src="cocoon://site/content/news.processed.xml"/>
> > > > <map:part
> > > >
> > src="cocoon://site/content/family.processed.xml"/>
> > > > </map:aggregate>
> > > > <map:transform
> > > > src="portal/xslt/news/join-with-people.xsl"/>
> > > > <map:transform
> > > > src="portal/xslt/news/news-item.xsl">
> > > > <map:parameter name="news-id"
> > > > value="{coplet:attributes/news-id}"/>
> > > > </map:transform>
> > > > <map:transform
> > > >
> > >
> >
> src="portal/styles/html/portlets/home/news-summary.xsl"/>
> > > > <map:act type="locale">
> > > > <map:transform type="i18n">
> > > > <map:parameter name="locale"
> > > > value="{locale}"/>
> > > > </map:transform>
> > > > </map:act>
> > > > <map:transform type="portal-coplet" />
> > > > <map:serialize type="xml"/>
> > > > </map:match>
> > > >
> > > > ===============================================
> > > > news-summary.xsl
> > > >
> > > > <cl:links>
> > > > <cl:link layout="maintab" value="3"
> > > > path="aspectDatas/tab"/>
> > > > <cl:link layout="newstab" value="2"
> > > > path="aspectDatas/tab"/>
> > > > <cl:link coplet="news-item-1" value="[EMAIL PROTECTED]"
> > > > path="parameters/news-id"/>
> > > > <cl:content>Read more</cl:content>
> > > > </cl:links>
> > > >
> > > > ============================================
> > > >
> > > > --- Laurent Trillaud <[EMAIL PROTECTED]> wrote:
> > > > > Alex
> > > > > Can you give snippets of your
> > > > > copletinstancedata/portal.xml file and your
> > > > > sitemap.xmap?
> > > > > Laurent
> > > > >
> > > > > > -----Message d'origine-----
> > > > > > De : Alex Romayev [mailto:[EMAIL PROTECTED]
> > > > > > Envoyi : mardi 20 janvier 2004 00:21
> > > > > > @ : [EMAIL PROTECTED]
> > > > > > Objet : RE: [portal] Linking to portal pages
> > > > > >
> > > > > > Laurent,
> > > > > >
> > > > > > I think I'm almost there, however I'm
> > getting an
> > > > > error
> > > > > > and I believe it is because I don't quite
> > > > > understand
> > > > > > your point #2 and making some mistake there.
> > > > The
> > > > > > error that I get is:
> > > > > >
> > > > > > org.apache.cocoon.ProcessingException:
> > Failed to
> > > > > > execute pipeline.:
> > > > > > org.apache.commons.jxpath.JXPathException:
> > > > > Exception
> > > > > > trying to set value with xpath
> > > > parameters/news-id;
> > > > > > Cannot set property /parameters/news-id,
> > path
> > > > does
> > > > > not
> > > > > > match a changeable location.
> > > > > >
> > > > > > Please see my comments below.
> > > > > >
> > > > > > Thanks,
> > > > > > -Alex
> > > > > >
> > > > > >
> > > > > > --- Laurent Trillaud <[EMAIL PROTECTED]>
> > wrote:
> > > > > > > Alex
> > > > > > > Yes, but it's a bad idea, because you
> > haven't
> > > > > > > insurance about coplets
> > > > > > > synchronization, and you will not have the
> > > > > benefit
> > > > > > > of the history record of
> > > > > > > the portal.
> > > > > > > The good design is to use coplet
> > attributes.
> > > > > > > 1. Declare an attributes in
> > > > > > > copletinstancedata/portal.xml
> > > > > > > <coplet-instance-data id="MyCoplet-1"
> > > > > > > name="standard">
> > > > > > > <coplet-data>MyCoplet</coplet-data>
> > > > > > > <attribute>
> > > > > > > <name>MyAttribute</name>
> > > > > > > <value
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> xsi:type="java:java.lang.String">MyDefaultValue</value>
> > > > > > > </attribute>
> > > > > > > </coplet-instance-data>
> > > > > >
> > > > > > OK, I did that -- my coplet instance is
> > named
> > > > > > "news-item-1" and the attribute "news-id".
> > I
> > > > also
> > > > > > noticed that the sample places the
> > attributes in
> > > > > > coplet definitions rather than coplet
> > instances,
> > > > > does
> > > > > > it matter?
> > > > > >
> > > > > > > 2. Use the portal-coplet transformer to
> > set
> > > > the
> > > > > > > attribute
> > > > > > > <cl:links>
> > > > > > > <cl:link layout="maintab" value="1"
> > > > > > > path="aspectDatas/tab"/>
> > > > > > > <cl:link coplet="MyCoplet-1"
> > value="MyValue"
> > > > > > > path="parameters/MyAttribute"/>
> > > > > > > <cl:content>My News Page</cl:content>
> > > > > > > </cl:links>
> > > > > > > It will produce another event on the href
> > > > > > > <a
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> href="portal?portal-action=n&portal-event=m&portal-event=m+1>
> > > > > > > My News Page</a>
> > > > > > > Be careful, to access to the MyCoplet-1
> > > > > attributes
> > > > > > > this transformer need to
> > > > > > > be call by the MyCoplet itself and with
> > the
> > > > > cocoon
> > > > > > > protocol.
> > > > > >
> > > > > > I'm not sure what you mean. In my case I
> > have 2
> > > > > > coplet instances: news-list-1 and
> > news-item-1.
> > > > > Each
> > > > > > item in the news list needs to have a link
> > to
> > > > the
> > > > > > corresponding news item. So I put the above
> > > > code
> > > > > in
> > > > > > the news-list-1 coplet and used the
> > > > > coplet-transformer
> > > > > > to generate the ancor tag.
> > > > > >
> > > > > > When I click on the generated link, I get
> > the
> > > > > "path
> > > > > > does not match a changeable location" error.
> > > > > >
> > > > > > If it's not the
> > > > > > > case use the portal action to 'load' it in
> > > > > memory.
> > > > > > > <map:act type="portal-object-model">
> > > > > > > <map:parameter name="portalName"
> > > > value="portal"
> > > > > />
> > > > > > > <map:parameter name="CopletId"
> > > > > value="MyCoplet-1" />
> > > > > > > </map:act>
> > > > > >
> > > > > > I think this is my case, since my news-list
> > > > coplet
> > > > > > needs to call news-item coplet. Where do I
> > > > place
> > > > > > this?
> > > > > >
> > > > > > > 3. use it
> > > > > > > Read value from the coplet input module.
> > For
> > > > > example
> > > > > > > to use it with an xsl
> > > > > > > <map:match pattern="MyCoplet.html">
> > > > > > > <map:generate src="MyData.xml" />
> > > > > > > <map:transform src="xml2html.xsl">
> > > > > > > <map:parameter name="MyParameter"
> > > > > > > value="{coplet:attributes/MyAttribute}"/>
> > > > > > > </map:transform>
> > > > > > > <map:serialize />
> > > > > > > </map:match>
> > > > > > >
> > > > > > > Laurent Trillaud
> > > > > > >
> > > > > > >
> > > > > > > > -----Message d'origine-----
> > > > > > > > De : Alex Romayev
> > [mailto:[EMAIL PROTECTED]
> > > > > > > > Envoyi : lundi 19 janvier 2004 15:31
> > > > > > > > @ : [EMAIL PROTECTED]
> > > > > > > > Objet : RE: [portal] Linking to portal
> > pages
> > > > > > > >
> > > > > > > > Thanks Laurent -- that works great!
> > > > > > > >
> > > > > > > > Another question, is there a way to pass
> > a
> > > > > request
> > > > > > > > parameter with it, so that the anchor is
> > > > > something
> > > > > > > > like:
> > > > > > > >
> > > > > > > > <a
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> href="portal?portal-action=n&portal-event=m&news-id=x>My>
> > > > > > > > News Page</a>
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > -Alex
> > > > > > > >
> > > > > > > > --- Laurent Trillaud
> > <[EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > > > > Hi,
> > > > > > > > > Events in the new portal engine are
> > very
> > > > > > > powerful
> > > > > > > > > but totally misdocumented.
> > > > > > > > > If you want a link to switch to a News
> > tab
> > > > > in
> > > > > > > your
> > > > > > > > > portal you need to create
> > > > > > > > > an event to say to the maintab
> > composite
> > > > > layout
> > > > > > > to
> > > > > > > > > switch to is second
> > > > > > > > > layout (0 based index) and send it to
> > the
> > > > > > > portal.
> > > > > > > > > Hoppefully, the portal-coplet
> > transformer
> > > > > will
> > > > > > > do it
> > > > > > > > > for you
> > > > > > > > > <cl:links>
> > > > > > > > > <cl:link layout="maintab" value="1"
> > > > > > > > > path="aspectDatas/tab"/>
> > > > > > > > > <cl:content>My News Page</cl:content>
> > > > > > > > > </cl:links>
> > > > > > > > > will be replace by
> > > > > > > > > <map:transform type="portal-coplet" />
> > > > > > > > > by an anchor
> > > > > > > > > <a
> > > > > > >
> > href="portal?portal-action=n&portal-event=m>My
> > > > > > > > > News Page</a>
> > > > > > > > > where n and m are auto-incremented
> > > > integer.
> > > > > > > > >
> > > > > > > > > If the link can't be compute inside
> > the
> > > > > portal,
> > > > > > > you
> > > > > > > > > can use the bookmark
> > > > > > > > > feature of the portal . The sample
> > include
> > > > > with
> > > > > > > > > cocoon use
> > > > > > > > > it(portal/resources/bookmarks.xml).
> > > > > > > > > Just write a link
> > > > > > > > > <a
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> href="http://myserver/myproject/portal/bookmark?showtab=1">
> > > > > > > > > My News Page</a> and it will do the
> > same
> > > > > thing.
> > > > > > > > >
> > > > > > > > > Laurent Trillaud
> > > > > > > > >
> > > > > > > > > > -----Message d'origine-----
> > > > > > > > > > De : Alex Romayev
> > > > > [mailto:[EMAIL PROTECTED]
> > > > > > > > > > Envoyi : vendredi 16 janvier 2004
> > 23:20
> > > > > > > > > > @ : [EMAIL PROTECTED]
> > > > > > > > > > Objet : [portal] Linking to portal
> > pages
> > > > > > > > > >
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > I am porting my site from old
> > portal-fw
> > > > to
> > > > > the
> > > > > > > new
> > > > > > > > > > portal engine. I was able to port
> > all
> > > > the
> > > > > > > coplets
> > > > > > > > > and
> > > > > > > > > > pages with any problems, however, I
> > got
> > > > > really
> > > > > > > > > stuck
> > > > > > > > > > on events. I am clearly missing the
> > > > point
> > > > > > > here,
> > > > > > > > > so
> > > > > > > > > > could someone at least point me in
> > the
> > > > > right
> > > > > > > > > direction
> > > > > > > > > > (an example would be great!)?
> > > > > > > > > >
> > > > > > > > > > I need to create a links to my
> > portal
> > > > > pages
> > > > > > > from
> > > > > > > > > > within coplet content. For example,
> > I
> > > > > used to
> > > > > > > > > have
> > > > > > > > > > News page, so I could use the
> > following:
> > > > > > > > > >
> > > > > > > > > > <a href=portal/news>News</a>
> > > > > > > > > >
> > > > > > > > > > Now my News page is represented as a
> > > > tab.
> > > > > How
> > > > > > > > > would I
> > > > > > > > > > generate the right link to this
> > page?
> > > > > > > > > >
> > > > > > > > > > Thanks,
> > > > > > > > > > -Alex
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > > > > > > 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]
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > =====
> > > > > > > > Alex Romayev
> > > > > > > > Software Architect
> > > > > > > > http://www.romayev.com
> > > > > > > > [EMAIL PROTECTED]
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > > > > 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]
> > > > > > >
> > > > > >
> > > > > >
> > > > > > =====
> > > > > > Alex Romayev
> > > > > > Software Architect
> > > > > > http://www.romayev.com
> > > > > > [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > > 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]
> > > > >
> > > >
> > > >
> > > > =====
> > > > Alex Romayev
> > > > Software Architect
> > > > http://www.romayev.com
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > >
> > >
> > >
> > > =====
> > > Alex Romayev
> > > Software Architect
> > > http://www.romayev.com
> > > [EMAIL PROTECTED]
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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]
> >
>
>
> =====
> Alex Romayev
> Software Architect
> http://www.romayev.com
> [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> 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]