You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Schultz, Gary - COMM" <GS...@commerce.state.wi.us> on 2006/08/25 21:16:08 UTC

Accessing value of contextPath

I running Cocoon 2.1.8.
 
I'm building a custom 404 page in Cocoon. What I want is for the error page
to display the Request URI to the user. At the moment I can only access the
value of the contextPath when it is used as the value of the href attribute
in a link <a> element. Whenever I try to access the contextPath in any other
way I get nothing. 
 
Here is code that works, I get the request URI from the contextPath:
 
<a href="{$contextPath}">link</a>
 
The following does not work, I would get an empty p element:
 
<p><xsl:value-of select="$contextPath"/></p>
 
So I just have a general question, Can the contextPath value be used in any
way other than the href attribute, and if so, how?
 
Gary T. Schultz
IT Administrator
Wisconsin Dept. of Commerce
608-266-1283
gschultz@commerce.state.wi.us

Re: Accessing value of contextPath

Posted by Lars Huttar <la...@sil.org>.
On 8/25/2006 2:16 PM, Schultz, Gary - COMM wrote:
> I running Cocoon 2.1.8.
>  
> I'm building a custom 404 page in Cocoon. What I want is for the error 
> page to display the Request URI to the user. At the moment I can only 
> access the value of the contextPath when it is used as the value of 
> the href attribute in a link <a> element. Whenever I try to access the 
> contextPath in any other way I get nothing.
>  
> Here is code that works, I get the request URI from the contextPath:
>  
> <a href="{$contextPath}">link</a>
>  
> The following does not work, I would get an empty p element:
>  
> <p><xsl:value-of select="$contextPath"/></p>
>  
> So I just have a general question, Can the contextPath value be used 
> in any way other than the href attribute, and if so, how?
>  
> Gary T. Schultz
> IT Administrator
> Wisconsin Dept. of Commerce
> 608-266-1283
> gschultz@commerce.state.wi.us
That's strange. Any variable, regardless of where its value came from, 
should be just as accessible via <xsl:value-of select="$contextPath"/> 
as via href="{$contextPath}".
Can you show us more of your stylesheet? Presumably you're getting the 
context path from the request input module in the sitemap and passing it 
in to the stylesheet as a parameter?

You might also try switching XSLT processors (e.g. from Xalan to Saxon) 
and see if you get an illuminating error message or if the problem goes 
away.

Lars


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org