cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <>
Subject Re: [C2] How to give intelligence to XSL ??
Date Wed, 03 Oct 2001 09:27:28 GMT
> Hello,
> I would like someone to help me to resolve a simple problem :
> I've got a few xml files...   page_X.xml
> all page_X.xml are transformed using pages.xsl
> In pages.xsl, I would like to add <a href="edit.xsp">EDIT ME!</a> only
> if request.getSession().getAttribute("editable") equals "1" ..
> how can I do ?? I don't want to add java code into my xml files... I
> want them in xml not xsp...
> what is the solution ??

One way is to specify params for your transformer in sitemap. This will
require an action which will propogate session attributes to sitemap. (As I
remember is what you need). Then you have to
set needed params in your matcher for the transformer - this will set those
params values for your transformation.
Then you'll have to add these to your stylesheet:
<!-- on the top level -->
<xsl:param name="editable">0</xsl:param>

<!-- in your template -->
<xsl:if test="$editable=1">
    <a href="edit.xsp">EDIT ME!</a>

That's all.

> There seems to be a session logicsheets in cocoon doc, but only for
> c1...

Logicsheets are absolutely useless during XSL transformation. But there is a
session logicsheet in C2 too, so you can use it in your XML file (See:

    Konstantin Piroumian

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message