On 04.05.2004 11:30, Nils Köster wrote:

Some weeks ago I comlained about not getting session content in variables in
xslt. I read much about others who had the same problem. Now I found out,
why it doesn't work.

It's not a bug, it's a feature.

What I tried:
---------------------------------
Some.xsl:
---------------------------------
...
<xsl:variable name="lang"><session:getxml context="bct"
path="/context/lang"/></xsl:variable>
...
---------------------------------


My sitemap looked like this: --------------------------------- <map:pipeline type="noncaching"> <map:match pattern="rmd_list"> <map:generate src="content/foo.xml"/> <map:transform src="style/xsl/some.xsl"/> (1) <map:transform type="session"/> (2) <map:serialize type="html"/> </map:match> </map:pipeline> ---------------------------------

The simple reason, why there will never be something in the variable while
processing the xsl is, that alle the xsl-stuff (1) (including the usage of
the variable) is done before the session-tags are processed by the
session-transformer (2).

For example:

If I have a <xsl:value-of select="$lang"/> somewhere in some.xsl, cocoon
would first replace this with nothing (1) and afterwards care about the
session-tags (2).

So, using session-content in variables will never work using the
session-transformer.

Any comments?

Hello Nils,


it seems you mix some things a bit. Though your observation is correct - it can not work in that way - IMO your pipeline setup seems to be just insufficient.

I never used the session transformer but I guess it expects elements in the session namespace as you provided it with <session:getxml/>. The problem is that this XML snippet never reaches the session as it never gets to see the stylesheet. And you do not add this snippet to the XML SAX stream (it's just a result tree fragment in $lang), which the session transformer would get to read.

I can imagine two solutions for a working pipeline:

<map:match>
  <map:generate src="content.xml"/>
  <map:transform src="addSessionMarkupToXMLStream.xsl"/>
  <map:transform type="session"/>
  <map:transform src="needsSessionInfoStyling.xsl"/>
  <map:serialize/>
</map:match>

or

<map:match>
  <map:aggregate>
    <map:part src="content.xml"/>
    <map:part src="cocoon:/sessioninfo"/>
  </map:aggregate>
  <map:transform src="needsSessionInfoStyling.xsl"/>
  <map:serialize/>
</map:match>

<map:match pattern="sessioninfo"/>
  <map:generate src="sessionMarkup.xml"/>
  <map:transform type="session"/>
  <map:serialize/>
</map:match>

If you have further questions on this feel free to ask. If it is irrelevant because you wanted to express the same, just ignore it :)

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to