You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by kmoens <kr...@yahoo.com> on 2009/06/16 14:05:10 UTC

Cocoon 2.1.7 create link with target in menu

Hi,

I am using Cocoon 2.1.7 and want to create a menu item that opens up a web
page in a new tab or window.

In the generic.xsp i have this code:

<block>
  <item>
    <xsp:attribute name="href">
      <xsp:expr>mypage + "?view=abc"</xsp:expr>
    </xsp:attribute>
    <i18n:text>ABC</i18n:text>
    <xsp:attribute name="target">_new</xsp:attribute>
  </item>
</block>


but the generated HTML for the menu has just a href element that points to
the page without a target attribute !?

Anyone knows a work-around to create links in menu items that open up the
link in a new tab or window?

Thanks

Kris


-- 
View this message in context: http://www.nabble.com/Cocoon-2.1.7-create-link-with-target-in-menu-tp24052933p24052933.html
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


RE: Cocoon 2.1.7 create link with target in menu

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Wed, 2009-06-17 at 06:05 -0700, kmoens wrote:
> Thanks Thorsten.
> 
> Indeed, I have to change the default menu2xhtml.xsl to allow the
> transformation of the target attribute.
> Thank you for the useful hint on this, it works now like expected.

glad it works.

salu2

> 
> BRs,
> 
> Kris 
>  
> 
> 
> Thorsten Scherler-3 wrote:
> > 
> > I guess the anove will be transformed by a xsl to html, right? In this
> > xsl do you allow/match the new target attribute? Seems not.
> > 
> 
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la InformaciĆ³n, S.A.U. (SADESI)





RE: Cocoon 2.1.7 create link with target in menu

Posted by kmoens <kr...@yahoo.com>.
Thanks Thorsten.

Indeed, I have to change the default menu2xhtml.xsl to allow the
transformation of the target attribute.
Thank you for the useful hint on this, it works now like expected.

BRs,

Kris 
 


Thorsten Scherler-3 wrote:
> 
> I guess the anove will be transformed by a xsl to html, right? In this
> xsl do you allow/match the new target attribute? Seems not.
> 

-- 
View this message in context: http://www.nabble.com/Cocoon-2.1.7-create-link-with-target-in-menu-tp24052933p24073261.html
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


RE: Cocoon 2.1.7 create link with target in menu

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Tue, 2009-06-16 at 06:10 -0700, kmoens wrote:
> Thanks Robby for the hint, but the result remains the same...
> The target attribute is simply not generated.
> 
> Even when I hard code it like
> 
> 
> <block>
>   <item>
>     <item href="http://www.nabble.com" target="_new">Go to Nabble</item>
>   </item>
> </block>
> 
> 
> the link in the menu does not take into account the target attribute. The
> generated source of the html is the href without the target.

I guess the anove will be transformed by a xsl to html, right? In this
xsl do you allow/match the new target attribute? Seems not.

salu2

> BRs,
> 
> Kris 
> 
> 
> 
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la InformaciĆ³n, S.A.U. (SADESI)





RE: Cocoon 2.1.7 create link with target in menu

Posted by kmoens <kr...@yahoo.com>.
Thanks Robby for the hint, but the result remains the same...
The target attribute is simply not generated.

Even when I hard code it like


<block>
  <item>
    <item href="http://www.nabble.com" target="_new">Go to Nabble</item>
  </item>
</block>


the link in the menu does not take into account the target attribute. The
generated source of the html is the href without the target.

BRs,

Kris 



-- 
View this message in context: http://www.nabble.com/Cocoon-2.1.7-create-link-with-target-in-menu-tp24052933p24054054.html
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


RE: Cocoon 2.1.7 create link with target in menu

Posted by Robby Pelssers <ro...@ciber.com>.
Can you try to put them in a order so  that all xsp:attributes come
first?

<block>
  <item>
    <xsp:attribute name="href">
      <xsp:expr>mypage + "?view=abc"</xsp:expr>
    </xsp:attribute>
    <xsp:attribute name="target">_new</xsp:attribute>
    <i18n:text>ABC</i18n:text>
  </item>
</block>


I'm not sure if this is the cause but I know that xslt for instance
throws an exception when you add childnodes after attributes.

Cheers,
Robby Pelssers

-----Original Message-----
From: kmoens [mailto:kris_moens@yahoo.com] 
Sent: Tuesday, June 16, 2009 2:05 PM
To: dev@cocoon.apache.org
Subject: Cocoon 2.1.7 create link with target in menu


Hi,

I am using Cocoon 2.1.7 and want to create a menu item that opens up a
web
page in a new tab or window.

In the generic.xsp i have this code:

<block>
  <item>
    <xsp:attribute name="href">
      <xsp:expr>mypage + "?view=abc"</xsp:expr>
    </xsp:attribute>
    <i18n:text>ABC</i18n:text>
    <xsp:attribute name="target">_new</xsp:attribute>
  </item>
</block>


but the generated HTML for the menu has just a href element that points
to
the page without a target attribute !?

Anyone knows a work-around to create links in menu items that open up
the
link in a new tab or window?

Thanks

Kris


-- 
View this message in context:
http://www.nabble.com/Cocoon-2.1.7-create-link-with-target-in-menu-tp240
52933p24052933.html
Sent from the Cocoon - Dev mailing list archive at Nabble.com.