You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sebastien Arbogast <se...@gmail.com> on 2005/05/17 01:07:51 UTC

[I18N] [Samples] [XSLT] Something I don't understand in I18N samples

Hi,

I'm trying to add some locale chooser widget to my user interface
using an auto-submit select element instead of the simple links showed
in I18N samples.
The problem I came to is the value of the URL to point towards to
change the locale: in
cocoon-2.1.7\build\webapp\samples\i18n\simple2page.xsl on line 112,
the href attribute of a is given the value '{@href}' and I had never
seen this syntax before in XSLT. Could someone explain to me what this
means and possibly what link I should use to make the current page
reloaded in the new language ?

I already have all the code :

locales.xml
========

<locales>
    <locale code="fr_FR" label="Français (France)" flag="fr_FR.gif"/>
    <locale code="en_US" label="English (US)" flag="en_US.gif"/>
</locales>


locales.xsl
========

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 
    xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
    
    <xsl:param name="current_locale" select="'fr_FR'"></xsl:param>
    
    <xsl:template match="/locales">
        <div>
        <form action="" >
            <select size="1" name="locale" id="locale_chooser"
                onchange="document.href=[........]"
                <xsl:apply-templates/>
            </select>
        </form>
        </div>
    </xsl:template>
    
    <xsl:template match="locale">
        <option>
            <xsl:if test="$current_locale = @code">
                <xsl:attribute name="selected">
                    <xsl:value-of select="'selected'"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:attribute name="value">
                <xsl:value-of select="@code"/>
            </xsl:attribute>
            <xsl:value-of select="@label"/>
        </option>
    </xsl:template>
    
    <xsl:template match="node()|@*" priority="-1">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

And everything is displayed fine. I just miss what I should put
instead of "[......]".

Thx in advance.
-- 
Sebastien ARBOGAST

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


Re: [I18N] [Samples] [XSLT] Something I don't understand in I18N samples

Posted by Sebastien Arbogast <se...@gmail.com>.
I finally found a solution to my problem. It seems that I just had a
few bugs in my XSLT stylesheet but now it works fine. I still don't
understand the meaning of the locale variable path though... just for
the sake of curiosity ;)

-- 
Sebastien ARBOGAST

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


Re: [I18N] [Samples] [XSLT] Something I don't understand in I18N samples

Posted by Sebastien Arbogast <se...@gmail.com>.
I tried to wrap my pattern matchings for that pipeline into a <map:act
type="locale"> element as it is done in I18N samples sitemap and as I
did it successfully for some other pipelines in my sitemap, like this
:

<map:pipeline internal-only="false">
            <map:act type="locale">
            <map:match pattern="gui/*">
                <map:call function="prepareGuiRegion">
                    <map:parameter name="gui-region" value="{1}"/>
                </map:call>
            </map:match>
             
            <map:match pattern="region/locales">
                <map:generate src="locales.xml" type="jx">
                    <map:parameter name="lenient-xpath" value="true"/>
                </map:generate>
                <map:transform src="themes/default/locales.xsl">
                    <map:parameter name="locale" value="{../locale}"/>
                </map:transform>
                <map:serialize type="xml"/>
            </map:match>
            
            </map:act>
        </map:pipeline>

But despite the fact that my locale action is correctly configured
(when I add the "?locale=..." querystring by hand to my URL,
everything works fine), I get the following exception when (and only
when) I add the wrapping action around my region/locales matching :

org.apache.cocoon.ProcessingException: Error executing pipeline.:
java.lang.RuntimeException: org.apache.cocoon.ProcessingException:
Exception during source resolving.:
org.apache.excalibur.source.SourceException: Exception during
processing of cocoon://admin/gui/locales
	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.handleException(AbstractProcessingPipeline.java:940)
	at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:281)
	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:483)
	at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.ContainerNode.invoke(ContainerNode.java:31)
	at org.apache.cocoon.components.treeprocessor.sitemap.CallNode.invoke(CallNode.java:93)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.invoke(ActTypeNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.handleCocoonRedirect(ConcreteTreeProcessor.java:298)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.access$000(ConcreteTreeProcessor.java:47)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor$TreeProcessorRedirector.cocoonRedirect(ConcreteTreeProcessor.java:339)
	at org.apache.cocoon.environment.ForwardRedirector.redirect(ForwardRedirector.java:59)
	at org.apache.cocoon.components.flow.AbstractInterpreter.forwardTo(AbstractInterpreter.java:209)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.forwardTo(FOM_JavaScriptInterpreter.java:894)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.forwardTo(FOM_Cocoon.java:698)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.jsFunction_sendPage(FOM_Cocoon.java:269)
	at inv8.invoke()
	at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:523)
	at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:438)
	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134)
	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190)
	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138)
	at org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121)
	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
	at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1591)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.handleContinuation(FOM_JavaScriptInterpreter.java:843)
	at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:123)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:608)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1123)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:172)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException:
org.apache.cocoon.ProcessingException: Exception during source
resolving.: org.apache.excalibur.source.SourceException: Exception
during processing of cocoon://admin/gui/locales
	at org.apache.xalan.transformer.TransformerImpl.run(Unknown Source)
	at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(Unknown
Source)
	at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:560)
	at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at org.apache.cocoon.forms.transformation.EffectPipe$Output.copy(EffectPipe.java:286)
	at org.apache.cocoon.forms.transformation.EffectWidgetReplacingPipe$DocHandler.process(EffectWidgetReplacingPipe.java:288)
	at org.apache.cocoon.forms.transformation.EffectPipe.endDocument(EffectPipe.java:428)
	at org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator.java:3181)
	at org.apache.cocoon.generation.JXTemplateGenerator.performGeneration(JXTemplateGenerator.java:2485)
	at org.apache.cocoon.generation.JXTemplateGenerator.access$1300(JXTemplateGenerator.java:120)
	at org.apache.cocoon.generation.JXTemplateGenerator$TransformerAdapter$TemplateConsumer.endDocument(JXTemplateGenerator.java:2260)
	at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:67)
	at org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStreamInterpreter.java:83)
	at org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(XMLByteStreamInterpreter.java:73)
	at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:267)
	... 84 more
java.lang.RuntimeException: org.apache.cocoon.ProcessingException:
Exception during source resolving.:
org.apache.excalibur.source.SourceException: Exception during
processing of cocoon://admin/gui/locales
	at org.apache.xalan.transformer.TransformerImpl.run(Unknown Source)
	at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(Unknown
Source)
	at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:560)
	at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at org.apache.cocoon.forms.transformation.EffectPipe$Output.copy(EffectPipe.java:286)
	at org.apache.cocoon.forms.transformation.EffectWidgetReplacingPipe$DocHandler.process(EffectWidgetReplacingPipe.java:288)
	at org.apache.cocoon.forms.transformation.EffectPipe.endDocument(EffectPipe.java:428)
	at org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator.java:3181)
	at org.apache.cocoon.generation.JXTemplateGenerator.performGeneration(JXTemplateGenerator.java:2485)
	at org.apache.cocoon.generation.JXTemplateGenerator.access$1300(JXTemplateGenerator.java:120)
	at org.apache.cocoon.generation.JXTemplateGenerator$TransformerAdapter$TemplateConsumer.endDocument(JXTemplateGenerator.java:2260)
	at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:67)
	at org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStreamInterpreter.java:83)
	at org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(XMLByteStreamInterpreter.java:73)
	at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:267)
	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:483)
	at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.ContainerNode.invoke(ContainerNode.java:31)
	at org.apache.cocoon.components.treeprocessor.sitemap.CallNode.invoke(CallNode.java:93)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.invoke(ActTypeNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.handleCocoonRedirect(ConcreteTreeProcessor.java:298)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.access$000(ConcreteTreeProcessor.java:47)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor$TreeProcessorRedirector.cocoonRedirect(ConcreteTreeProcessor.java:339)
	at org.apache.cocoon.environment.ForwardRedirector.redirect(ForwardRedirector.java:59)
	at org.apache.cocoon.components.flow.AbstractInterpreter.forwardTo(AbstractInterpreter.java:209)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.forwardTo(FOM_JavaScriptInterpreter.java:894)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.forwardTo(FOM_Cocoon.java:698)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.jsFunction_sendPage(FOM_Cocoon.java:269)
	at inv8.invoke()
	at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:523)
	at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:438)
	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134)
	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190)
	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138)
	at org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121)
	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
	at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1591)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.handleContinuation(FOM_JavaScriptInterpreter.java:843)
	at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:123)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:608)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1123)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:172)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Unknown Source)

The thing is I don't understand the exact meaning of the path the the
locale variable : why {../locale} here, {../../locale} in resources
and not simply {locale} ? What is this "path" relative to ? And what
could be the source of this exception I get ?

Thx in advance.

-- 
Sebastien ARBOGAST

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


Re: [I18N] [Samples] [XSLT] Something I don't understand in I18N samples

Posted by Sebastien Arbogast <se...@gmail.com>.
> Maybe document.href=document.href?locale={@code}

Thanks Marc but I already have that code now. In fact it's
"location.href='?locale='+[the value selected in the selection list]"
Now my problem is to manage to pass the current locale from the
sitemap to my XSLT stylesheet. I tried the {../../locale} as it works
for the i18n transformer but I'm afraid this sitemap variable is not
set when I call the transformation.
But I configured the locale component to write the variable to the
session. Is it possible to use the variable from the session instead
of the sitemap variable to pass it to my transformation ? How should I
configure my pattern matching ?

-- 
Sebastien ARBOGAST

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


Re: [I18N] [Samples] [XSLT] Something I don't understand in I18N samples

Posted by Marc Salvetti <ma...@notremanou.net>.
Maybe document.href=document.href?locale={@code}

Cheers,

Marc

Sebastien Arbogast a écrit :

>Hi,
>
>I'm trying to add some locale chooser widget to my user interface
>using an auto-submit select element instead of the simple links showed
>in I18N samples.
>The problem I came to is the value of the URL to point towards to
>change the locale: in
>cocoon-2.1.7\build\webapp\samples\i18n\simple2page.xsl on line 112,
>the href attribute of a is given the value '{@href}' and I had never
>seen this syntax before in XSLT. Could someone explain to me what this
>means and possibly what link I should use to make the current page
>reloaded in the new language ?
>
>I already have all the code :
>
>locales.xml
>========
>
><locales>
>    <locale code="fr_FR" label="Français (France)" flag="fr_FR.gif"/>
>    <locale code="en_US" label="English (US)" flag="en_US.gif"/>
></locales>
>
>
>locales.xsl
>========
>
><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 
>    xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>    
>    <xsl:param name="current_locale" select="'fr_FR'"></xsl:param>
>    
>    <xsl:template match="/locales">
>        <div>
>        <form action="" >
>            <select size="1" name="locale" id="locale_chooser"
>                onchange="document.href=[........]"
>                <xsl:apply-templates/>
>            </select>
>        </form>
>        </div>
>    </xsl:template>
>    
>    <xsl:template match="locale">
>        <option>
>            <xsl:if test="$current_locale = @code">
>                <xsl:attribute name="selected">
>                    <xsl:value-of select="'selected'"/>
>                </xsl:attribute>
>            </xsl:if>
>            <xsl:attribute name="value">
>                <xsl:value-of select="@code"/>
>            </xsl:attribute>
>            <xsl:value-of select="@label"/>
>        </option>
>    </xsl:template>
>    
>    <xsl:template match="node()|@*" priority="-1">
>        <xsl:copy>
>            <xsl:apply-templates select="@*"/>
>            <xsl:apply-templates/>
>        </xsl:copy>
>    </xsl:template>
></xsl:stylesheet>
>
>And everything is displayed fine. I just miss what I should put
>instead of "[......]".
>
>Thx in advance.
>  
>


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


Re: [I18N] [Samples] [XSLT] Something I don't understand in I18N samples

Posted by Sebastien Arbogast <se...@gmail.com>.
By the way I forgot to specify that I already know how to get the
value of the new locale selected using javascript :

document.getElementById('locale_chooser').options[document.getElementById('locale_chooser').options.selectedIndex].value

I checked with a alert and this works. I just need to find out where
to put it in order to make it change the locale.

-- 
Sebastien ARBOGAST

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


Re: [I18N] [Samples] [XSLT] Something I don't understand in I18N samples

Posted by Sebastien Arbogast <se...@gmail.com>.
> <a href="{@href}" class="page">
> 
> Means "generate an a and set its href attribute to the value of the
> href attribute of the current node".
> 
> {} is the equivalent of "xsl:value-of select.." for attributes.

OK thanks. I didn't know this XSLT syntax but I've just checked in my
XSLT bible and it's very well explained. I must have skipped this
paragraph the first time I read it ;-)

So now I understand that syntax, knowing that @href is given a value
like "?locale=fr_FR", I'm trying to replace the simple link by a
selection list that triggers a locale change everytime the selection
value changes. I managed to make that work with the following template
:

<xsl:template match="/locales">
        <div>
            <xsl:value-of select="$current_locale"/>
        <form action="" method="POST" name="locale_chooser_form">
            <select size="1" name="locale" id="locale_chooser"
               
onchange="location.href='?locale='+document.getElementById('locale_chooser').options[document.getElementById('locale_chooser').options.selectedIndex].value">
                <xsl:apply-templates/>
            </select>
        </form>
        </div>
    </xsl:template>

<xsl:template match="locale">
        <option>
            <xsl:if test="$current_locale = @code">
                <xsl:attribute name="selected">
                    <xsl:value-of select="'selected'"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:attribute name="value">
                <xsl:value-of select="@code"/>
            </xsl:attribute>
            <xsl:value-of select="@label"/>
        </option>
    </xsl:template>

It works great for the functionality but there is a bug : I don't
manage to set the current_locale parameter for the transformation to
the locale currently selected. Here is the corresponding sitemap
snippet :

<map:match pattern="region/locales">
                <map:generate src="locales.xml" type="jx">
                    <map:parameter name="lenient-xpath" value="true"/>
                </map:generate>
                <map:transform src="themes/default/locales.xsl">
                    <map:parameter name="current_locale" value="{../locale}"/>
                </map:transform>
                <map:serialize type="xml"/>
            </map:match>

But it doesn't set the selected attribute correctly. Any idea ?

-- 
Sebastien ARBOGAST

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


Re: [I18N] [Samples] [XSLT] Something I don't understand in I18N samples

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 17 mai 05, à 01:07, Sebastien Arbogast a écrit :

> ...in
> cocoon-2.1.7\build\webapp\samples\i18n\simple2page.xsl on line 112,
> the href attribute of a is given the value '{@href}' and I had never
> seen this syntax before in XSLT...


<a href="{@href}" class="page">

Means "generate an a and set its href attribute to the value of the 
href attribute of the current node".

{} is the equivalent of "xsl:value-of select.." for attributes.

-Bertrand