Thank you very much Jan! "Jan Hoskens" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ilja Smoli wrote: > > Hi Jan > > Im sorry Im new to cocoon.. > > Im not sure I got this: > > "Eg: include the pipeline with your sessiontransformer in your normal > > document and xslt sets parameters in links. This way you can get your > > parameters easily with xpath expressions." > > Can you please provide little example of this? > > I have smth like this: > > --------------------------- > > <map:match pattern="internal/*"> > > <map:generate src="screens/{1}.xml"/> > > <map:transform type="session"/> > > <map:transform src="resources/simple-page2html.xsl"> > > </map:transform> > > <map:transform type="encodeURL"/> > > <map:serialize/> > > </map:match> > > ------------------------------ > > and my screen is: > > ------------------------------ > > <?xml version="1.0"?> > > <page> > > <title>Home</title> > > <content xmlns:session="http://apache.org/cocoon/session/1.0"> > > > > <!-- THIS I understand (how to just display data from session context)--> > > <session:getxml context="authentication" path="/"/> > > </content> > > </page> > > ------------------------------ > > but how to add params to links? This probably can be done in my xsl? > > > > You're half way there. Starting from your example the easiest way to go is (according to me, of > course) set your session stuff outside the content, you probably don't want to show every session > element on the page, but just select some of them to eg. use in a link as a parameter. Think of the > content tag as the one which will be transformed to a html page, and the other elements (title and > session) as usefull resources for that content. > > <page> > <title>...</title> > <session> > <!--do your session stuff here: getxml ... any context needed --> > </session> > <content> > .... > <mylink to="sessionparamlink.html" type="session"/> > </content> > </page> > > then in your xsl: > > <xsl:template match="[EMAIL PROTECTED]'session']"> > <a href="[EMAIL PROTECTED]/page/session/path_to_session}"/> > </xsl:template> > > in the <a/> element I've used braces {}, these are shortcuts. You can do the same with > <a> > <xsl:attribute name="href"><!--xsl:value-of .... as you probably know--></xsl:attribute> > </a> > > > If you need your session stuff on each page (and maybe some other info as well) you might want to > try includes. (This way you don't have to write the session stuff in each page.) Define one overal > look page and include your content/info/session in that page: > > <page> > <cinclude:include src="cocoon:/internal/sessioninfo"/> > <cinclude:include src="cocoon:/internal/someotherinfo"/><!-- things shared among pages, footers > or whatever--> > <cinclude:include src="cocoon:/internal/{mypage}"/><!-- passed from sitemap --> > </page> > > Transform with the cinclude transformer (look at the cocoon docs) and end up with something like: > > <page> > <sessioninfo /> > <someotherinfo /> > <content /> > </page> > > and do the same thing in your final xsl: transform the content to html and use the info elements to > add extra info. > > This is of course one way to go, and there are many... > > I always try to limit duplicated code, so when sessionstuff appears everywhere and has the same > process in each page, try to extract that piece (eg as the last example). > > Kind Regards, > Jan > > > > > > > > > "Jan Hoskens" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >>If you're only goal is to show the profile you stored in the session > > > > context, you can retreive it > > > >>with the session transformer and then process the data there. Eg: include > > > > the pipeline with your > > > >>sessiontransformer in your normal document and xslt sets parameters in > > > > links. This way you can get > > > >>your parameters easily with xpath expressions. (at first thought, I would > > > > prefer this instead of > > > >>passing parameters if you have to work with a complete xml structure) > >> > >>If you want to edit the profile, I would suggest a combination of > > > > flowscript/cforms. In the > > > >>flowscript retreive the base xml document from your session, create a form > > > > and send it through a > > > >>form-display-pipeline. > >> > >>Kind Regards, > >>Jan > >> > >>Ilja Smoli wrote: > >> > >>>Thanks Jan! > >>>I got the idea now... > >>>Little problem that this ( {ID} ) will work only in pipeline which > > > > exactly > > > >>>uses auth handler.. > >>>Cause I have a bunch of pages to protect , I have one pipeline with > >>>"protect" which uses then internal pipelines, but I think i can handle > > > > this > > > >>>problem.. > >>>Other question is can you please point me out on this: > >>>I want to have like this (really common for webapps :-) ): after user > > > > login, > > > >>>have a session with user data (names, adresses etc...). This I can do > > > > using > > > >>>this "auth fw" and put everithing in session contexts. Problem actually > > > > in > > > >>>retrieving this data... Like to add parameters to links etc... > >>>For docs I use xml, transformed through xsl... > >>>For example I need a link like > >>><a href=edit_form?username=get username from session>Edit profile</a> > >>> > >>>Where it is better to do this? > >>>In xsl like: > >>><xsl:template match="editProfileLink"> > >>>Here goes html code for this link with added params from session > >>> </xsl:template> > >>> > >>>or directly in xml doc? > >>>Im confused about this :) > >>>thx in advance... > >>> > >>> > >>>"Jan Hoskens" <[EMAIL PROTECTED]> wrote in message > >>>news:[EMAIL PROTECTED] > >>> > >>> > >>>>When the user is authenticated, you can use {ID} and {ROLE} in your > >>> > >>>sitemap: > >>> > >>> > >>>><!-- taken from > >>> > >>>http://cocoon.apache.org/2.1/developing/webapps/authentication.html > >>> > >>> > >>>>at the bottom --> > >>>> > >>>><map:match pattern"protected"> > >>>> <map:act type="auth-protect"> <!-- protect the resource --> > >>>> <map:parameter name="handler" value="myhandler"/> > >>>> > >>>> <!-- Append the ID of the user to the file name --> > >>>> <map:generate src="resource_{ID}.xml"/> > >>>> <map:transform src="toHTML"/> > >>>> <map:serialize/> > >>>> > >>>> </map:act> > >>>></map:match> > >>>> > >>>>Pass it to an xsl stylesheet: > >>>><map:transform src="mysheet.xsl"> > >>>><map:parameter name="login" value="{ID}" /> > >>>></map:transform> > >>>> > >>>>and in your stylesheet declare at toplevel: > >>>> > >>>><xsl:stylesheet...> > >>>><xsl:param name="login"/> > >>>> > >>>> > >>>>If needed: there are ways to get session xml in flowscript or > > > > jxtemplates, > > > >>>just give a sign if you > >>> > >>> > >>>>need these (they are somewhere on the mail archives too). > >>>> > >>>>Kind regards, > >>>>Jan > >>>> > >>>>Ilja Smoli wrote: > >>>> > >>>> > >>>>>Thx for reply > >>>>>But as I understood authentication fw stores session object as xml > >>>>>and i can not get attributes using {session:} :( > >>>>> > >>>>> > >>>>>"Bowe, Bastian" <[EMAIL PROTECTED]> wrote in message > >>>>> > >>> > >>> > > news:[EMAIL PROTECTED] > > > >>>>>>Never used session. But can't you use {session:username} as a > >>>>>><map:parameter/> for your <map:transform type="xsl"/> ? > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>>>-----Original Message----- > >>>>>>>From: Ilja Smoli [mailto:[EMAIL PROTECTED] > >>>>>>>Sent: Monday, February 14, 2005 2:33 PM > >>>>>>>To: users@cocoon.apache.org > >>>>>>>Subject: session context > >>>>>>> > >>>>>>> > >>>>>>>Hi > >>>>>>>I use authentification framework in cocoon 2.1.5... > >>>>>>>I know that to get data out of session I can use > >>>>>>><session:getxml... tag But what if i need this in XSL > >>>>>>>stylesheet? Or for example in my xml page where i want to put > >>>>>>>some value from session to link as query parameter? Smth like: > >>>>>>>------------------------------- > >>>>>>><?xml version="1.0"?> > >>>>>>><page> > >>>>>>><title>Home</title> > >>>>>>><content> > >>>>>>><center> > >>>>>>> <a href='edit-form-person?user=HERE must go > >>>>>>>username from session'>Edit profile</a><br/> ................ > >>>>>>> > >>>>>>>Thx in advance... > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>--------------------------------------------------------------------- > >>>>>>>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] > >>>>> > >>>>> > >>> > >>> > >>> > >>> > >>> > >>>--------------------------------------------------------------------- > >>>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] > > > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]