[C3] Can i18n transformer use an internal pipeline as bundle?
Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
Hello Alberto, Have you defined map:match pattern=translations_*.properties with: map:generate type=service-consumer/ ? Otherwise: map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / will not work as expected. Take a look at C3 samples sitemap.xmap [1] which shows correct definition of service consumer. Greetings, Greg [1] http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/sitemap.xmap 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
Hello Alberto, One more thing is that any map:transform or map:serialize must have: type=servlet-service with servlet:/ protocol. Greetings, Greg 2014/1/17 gelo1234 gelo1...@gmail.com Hello Alberto, Have you defined map:match pattern=translations_*.properties with: map:generate type=service-consumer/ ? Otherwise: map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / will not work as expected. Take a look at C3 samples sitemap.xmap [1] which shows correct definition of service consumer. Greetings, Greg [1] http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/sitemap.xmap 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: cocoon-xml-2.0.4
2014/1/16 gelo1234 gelo1...@gmail.com Hi Salu2, Thanks for clarifying this. Now I got interested in cocoon-osgi, but it seems like rather old stuff (and uses old spring release). Any plans to reactivate this subproject ? It would be awesome to see cocoon integrated with e.g. Karaf with Blueprint config. That should be great but unfortunately I don't know the status about osgi support. I don't know about osgi so I can't contribute about but I can help with the Apache Cocoon side :-). I remember that some Cocoon members talked about in the past ApacheCon 2012 in Sinsheim about integrate it with osgi. Maybe someone wants to contribute. There's an issue open in the Jira system with a patch, you could give it a try. https://issues.apache.org/jira/browse/COCOON3-87 Regards (Salu2) PD: Salu2 is a Spanish phonetic word that means regards but it's written like l8ter. The original word is Saludos. ;-) Greetings, Greg 2014/1/16 Javier Puerto jpue...@gmail.com Hi Greg, 2014/1/16 gelo1234 gelo1...@gmail.com Hello, I wonder how to classify C3-beta dependency: cocoon-xml ? Which project does that dependency belong to ? It's part of Apache Cocoon subprojets. http://svn.apache.org/repos/asf/cocoon/subprojects/ http://cocoon.apache.org/subprojects/ As I got it right, it is NOT part of Cocoon 3.0-beta package ? Is it just a separate jar file from Apache Maven repo ? Or a part or separate project like Apache Commons ? It's part of Cocoon as libraries and are used by different releases like version 2.2.x. For maven you can use Apache repository. https://repository.apache.org/index.html#view-repositories cocoon-sax (which is part of C3-beta) depends on cocoon-xml Greetings, Greg Salu2.
Re: cocoon-xml-2.0.4
Thank you Javier :) That is getting even more interesting to me. I mean osgi-compliance of cocoon :) I will take a look at this port. Greetings, Greg PS: Do you use (english?) Xavier name too ? I used to write my nick Gelo in mails, but afaik gelo means ice in portuguese while im rather hot ;) 2014/1/17 Javier Puerto jpue...@gmail.com 2014/1/16 gelo1234 gelo1...@gmail.com Hi Salu2, Thanks for clarifying this. Now I got interested in cocoon-osgi, but it seems like rather old stuff (and uses old spring release). Any plans to reactivate this subproject ? It would be awesome to see cocoon integrated with e.g. Karaf with Blueprint config. That should be great but unfortunately I don't know the status about osgi support. I don't know about osgi so I can't contribute about but I can help with the Apache Cocoon side :-). I remember that some Cocoon members talked about in the past ApacheCon 2012 in Sinsheim about integrate it with osgi. Maybe someone wants to contribute. There's an issue open in the Jira system with a patch, you could give it a try. https://issues.apache.org/jira/browse/COCOON3-87 Regards (Salu2) PD: Salu2 is a Spanish phonetic word that means regards but it's written like l8ter. The original word is Saludos. ;-) Greetings, Greg 2014/1/16 Javier Puerto jpue...@gmail.com Hi Greg, 2014/1/16 gelo1234 gelo1...@gmail.com Hello, I wonder how to classify C3-beta dependency: cocoon-xml ? Which project does that dependency belong to ? It's part of Apache Cocoon subprojets. http://svn.apache.org/repos/asf/cocoon/subprojects/ http://cocoon.apache.org/subprojects/ As I got it right, it is NOT part of Cocoon 3.0-beta package ? Is it just a separate jar file from Apache Maven repo ? Or a part or separate project like Apache Commons ? It's part of Cocoon as libraries and are used by different releases like version 2.2.x. For maven you can use Apache repository. https://repository.apache.org/index.html#view-repositories cocoon-sax (which is part of C3-beta) depends on cocoon-xml Greetings, Greg Salu2.
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
Hi Greg, I already took a look to the sample sitemap and I found the following example: map:match pattern=internal-only/simple-xml map:generate src=sax-pipeline/simple.xml / map:transform src=sax-pipeline/simple.xslt map:parameter name=myParam value=3-{jexl:cocoon.request.ssf} / /map:transform map:serialize type=xml / /map:match map:match pattern=ssf/local-internal-only map:generate src=servlet:/internal-only/simple-xml / map:serialize type=xml / /map:match Second match uses servlet: protocol. The internal-only/simple-xml match is used as source of data. So I supposed it is something similar to my needs. i18n bundle parameter needs a source of data, usually a file (better, a group of file, as java.util.ResourceBundle is). In this case no service-consumer or servlet-service are used. Reading the sample sitemap I understood that service-consumer and servlet-service are used when you want to use a match as transformer or serializer. I understood wrong? Regards Alberto On Fri, 2014-01-17 at 11:32 +0100, gelo1234 wrote: Hello Alberto, One more thing is that any map:transform or map:serialize must have: type=servlet-service with servlet:/ protocol. Greetings, Greg 2014/1/17 gelo1234 gelo1...@gmail.com Hello Alberto, Have you defined map:match pattern=translations_*.properties with: map:generate type=service-consumer/ ? Otherwise: map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / will not work as expected. Take a look at C3 samples sitemap.xmap [1] which shows correct definition of service consumer. Greetings, Greg [1] http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/sitemap.xmap 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
Hi Alberto, Yes, servlet-service is used if acting as a transformer or a serializer. If you use generator, there is no need to specify servlet-service. I used servlet:/ protocol in many generator cases and from within XIncludeTransformer (x:xinclude) but not as a map:parameter so far. Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi Greg, I already took a look to the sample sitemap and I found the following example: map:match pattern=internal-only/simple-xml map:generate src=sax-pipeline/simple.xml / map:transform src=sax-pipeline/simple.xslt map:parameter name=myParam value=3-{jexl:cocoon.request.ssf} / /map:transform map:serialize type=xml / /map:match map:match pattern=ssf/local-internal-only map:generate src=servlet:/internal-only/simple-xml / map:serialize type=xml / /map:match Second match uses servlet: protocol. The internal-only/simple-xml match is used as source of data. So I supposed it is something similar to my needs. i18n bundle parameter needs a source of data, usually a file (better, a group of file, as java.util.ResourceBundle is). In this case no service-consumer or servlet-service are used. Reading the sample sitemap I understood that service-consumer and servlet-service are used when you want to use a match as transformer or serializer. I understood wrong? Regards Alberto On Fri, 2014-01-17 at 11:32 +0100, gelo1234 wrote: Hello Alberto, One more thing is that any map:transform or map:serialize must have: type=servlet-service with servlet:/ protocol. Greetings, Greg 2014/1/17 gelo1234 gelo1...@gmail.com Hello Alberto, Have you defined map:match pattern=translations_*.properties with: map:generate type=service-consumer/ ? Otherwise: map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / will not work as expected. Take a look at C3 samples sitemap.xmap [1] which shows correct definition of service consumer. Greetings, Greg [1] http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/sitemap.xmap 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
Looking deepest in the apidocs I gather that's no way to use a pipeline as bundle for i18n transformer in cocoon 3. In fact it uses a ResourceBundle object that needs physical files. In 2.1 version there is org.apache.cocoon.environment.SourceResolver in the setup() method. I suppose it is able to deal with cocoon: protocol. I'm a little bit disappointed about that. One of the best thing of cocoon is its dynamic nature. Is there any workaround? Or can any cocoon developer give some suggest to help me to write a patch? Best regards Alberto On Fri, 2014-01-17 at 13:40 +0100, gelo1234 wrote: Hi Alberto, Yes, servlet-service is used if acting as a transformer or a serializer. If you use generator, there is no need to specify servlet-service. I used servlet:/ protocol in many generator cases and from within XIncludeTransformer (x:xinclude) but not as a map:parameter so far. Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi Greg, I already took a look to the sample sitemap and I found the following example: map:match pattern=internal-only/simple-xml map:generate src=sax-pipeline/simple.xml / map:transform src=sax-pipeline/simple.xslt map:parameter name=myParam value=3-{jexl:cocoon.request.ssf} / /map:transform map:serialize type=xml / /map:match map:match pattern=ssf/local-internal-only map:generate src=servlet:/internal-only/simple-xml / map:serialize type=xml / /map:match Second match uses servlet: protocol. The internal-only/simple-xml match is used as source of data. So I supposed it is something similar to my needs. i18n bundle parameter needs a source of data, usually a file (better, a group of file, as java.util.ResourceBundle is). In this case no service-consumer or servlet-service are used. Reading the sample sitemap I understood that service-consumer and servlet-service are used when you want to use a match as transformer or serializer. I understood wrong? Regards Alberto On Fri, 2014-01-17 at 11:32 +0100, gelo1234 wrote: Hello Alberto, One more thing is that any map:transform or map:serialize must have: type=servlet-service with servlet:/ protocol. Greetings, Greg 2014/1/17 gelo1234 gelo1...@gmail.com Hello Alberto, Have you defined map:match pattern=translations_*.properties with: map:generate type=service-consumer/ ? Otherwise: map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / will not work as expected. Take a look at C3 samples sitemap.xmap [1] which shows correct definition of service consumer. Greetings, Greg [1] http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/sitemap.xmap 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
Can you show here your full original Cocoon pipeline ? Do you store property files content or property filenames inside db ? Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
Yes, it's really simple. The source file is an xml file with a sqltransformer query. The query is simple: just a select to a specific table (or view) with a where condition. Then an xsl transformer convert the xml to txt with a pair of key and value for every row. That's all. map:pipeline internal-only=true map:match pattern=translations_*.properties map:generate type=string-template src=files/dbdata.xml map:parameter name=table value=messages/ map:parameter name=fields value=key_value, value/ map:parameter name=condition value=lang_id='{map:1}'/ map:parameter name=orderfields value=1/ map:parameter name=rowcount value=10/ /map:generate map:transform type=sql map:parameter name=use-connection value=dataSource / /map:transform map:transform src=stylesheets/sql2properties.xsl/ map:serialize type=txt/ /map:match This is a snip of the xsl stylesheet: xsl:template match=sql:row xsl:text xsl:value-of select=sql:key_value//xsl:text xsl:text=/xsl:text xsl:textxsl:value-of select=sql:value//xsl:text /xsl:template Alberto On Fri, 2014-01-17 at 15:30 +0100, gelo1234 wrote: Can you show here your full original Cocoon pipeline ? Do you store property files content or property filenames inside db ? Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
How about a workaround that puts those properties values into XSL params and transform with standard XSLTransformer not i18nTransformer ? Where do you need those properties in pipeline ? Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Yes, it's really simple. The source file is an xml file with a sqltransformer query. The query is simple: just a select to a specific table (or view) with a where condition. Then an xsl transformer convert the xml to txt with a pair of key and value for every row. That's all. map:pipeline internal-only=true map:match pattern=translations_*.properties map:generate type=string-template src=files/dbdata.xml map:parameter name=table value=messages/ map:parameter name=fields value=key_value, value/ map:parameter name=condition value=lang_id='{map:1}'/ map:parameter name=orderfields value=1/ map:parameter name=rowcount value=10/ /map:generate map:transform type=sql map:parameter name=use-connection value=dataSource / /map:transform map:transform src=stylesheets/sql2properties.xsl/ map:serialize type=txt/ /map:match This is a snip of the xsl stylesheet: xsl:template match=sql:row xsl:text xsl:value-of select=sql:key_value//xsl:text xsl:text=/xsl:text xsl:textxsl:value-of select=sql:value//xsl:text /xsl:template Alberto On Fri, 2014-01-17 at 15:30 +0100, gelo1234 wrote: Can you show here your full original Cocoon pipeline ? Do you store property files content or property filenames inside db ? Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
On Fri, 2014-01-17 at 16:44 +0100, gelo1234 wrote: How about a workaround that puts those properties values into XSL params and transform with standard XSLTransformer not i18nTransformer ? mmh, it seems quite complicated. The properties file is more than one hundred lines long. How can I pass all these properties? A choice could be a dynamic xslt, built querying the database. But can I specify a servlet: protocol in the src attribute of an xsl transformer? I think no. Where do you need those properties in pipeline ? I have a pipeline that produce an html page, querying a database. map:match pattern=homepage map:generate src=files/homepage.xml / map:transform type=sql map:parameter name=use-connection value=dataSource / /map:transform map:transform src=stylesheets/homepage-sql2xml.xsl/ map:transform type=i18n map:parameter name=locale value={jexl:cocoon.request.lang} / map:parameter name=bundle value=COB-INF/files/translations / /map:transform map:transform src=stylesheets/homepage2html.xsl/ etc... Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Yes, it's really simple. The source file is an xml file with a sqltransformer query. The query is simple: just a select to a specific table (or view) with a where condition. Then an xsl transformer convert the xml to txt with a pair of key and value for every row. That's all. map:pipeline internal-only=true map:match pattern=translations_*.properties map:generate type=string-template src=files/dbdata.xml map:parameter name=table value=messages/ map:parameter name=fields value=key_value, value/ map:parameter name=condition value=lang_id='{map:1}'/ map:parameter name=orderfields value=1/ map:parameter name=rowcount value=10/ /map:generate map:transform type=sql map:parameter name=use-connection value=dataSource / /map:transform map:transform src=stylesheets/sql2properties.xsl/ map:serialize type=txt/ /map:match This is a snip of the xsl stylesheet: xsl:template match=sql:row xsl:text xsl:value-of select=sql:key_value//xsl:text xsl:text=/xsl:text xsl:textxsl:value-of select=sql:value//xsl:text /xsl:template Alberto On Fri, 2014-01-17 at 15:30 +0100, gelo1234 wrote: Can you show here your full original Cocoon pipeline ? Do you store property files content or property filenames inside db ? Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Hi, I'm migrating a 2.1 cocoon application to 3.0, using beta1-SNAPSHOT because I need the sql transformer. As I wrote in the subject, I'm need to specify an internal pipeline as bundle for the i18n transformer, because the properties file has to be derived from database. Using a plain file it works. I tried several urls using servlet: protocol, but without success. I have the following internal pipeline: map:match pattern=translations_*.properties and I tried several bundles urls like: map:parameter name=bundle value=servlet:/translations / or map:parameter name=bundle value=servlet:/translations_{jexl:cocoon.request.lang}.properties / The exception is: org.apache.cocoon.pipeline.SetupException: java.util.MissingResourceException: Can't find bundle for base name servlet:/translations, locale en What I doing wrong? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org
Re: [C3] Can i18n transformer use an internal pipeline as bundle?
OK, 100 xslt params would be too complicated as xslt params. I have 2 more options though :) 1. Option with pure xml/xsl How about making properties a raw xml data (with xml serializer, not txt), e.g. properties key1value1/key1 key2value2/key2 ... keyNvalueN/keyN /properties and in subsequent XSLT use: xsl:variable name=properties select=/Root/properties/ and each parameter inserted with xsl:value-of select=$properties/keyX/ ? With this approach, it is a matter of rewriting your XSL that generates HTML. 2. Option with RESTController Use generator to get properties out from database and put it inside a Map, then call string-template to render XML/HTML with values from Map: map:match pattern=homepage map:generate src=homepage.xhtml type=stringtemplate / map:serialize type=html //map:match map:match pattern=homepage.html controller:call controller=rest-controller select=HomepageController map:parameter name=lang value={jexl:cocoon.request.lang} / /controller:call/map:match @RESTControllerpublic class HomepageController implements Get { @SitemapParameter private String lang; @RequestParameter private String someParam; public RestResponse doGet() throws Exception { // get properties out from database -- custom jdbc code here ResultSet rs = properties_from_db; // put it inside Map MapString, Object data = new HashMapString, Object(); while (rs.hasNext()) { rs.next(); data.put(rs.getString(key), rs.getString(value)); } return new Page(servlet:/homepage, data); }} Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it On Fri, 2014-01-17 at 16:44 +0100, gelo1234 wrote: How about a workaround that puts those properties values into XSL params and transform with standard XSLTransformer not i18nTransformer ? mmh, it seems quite complicated. The properties file is more than one hundred lines long. How can I pass all these properties? A choice could be a dynamic xslt, built querying the database. But can I specify a servlet: protocol in the src attribute of an xsl transformer? I think no. Where do you need those properties in pipeline ? I have a pipeline that produce an html page, querying a database. map:match pattern=homepage map:generate src=files/homepage.xml / map:transform type=sql map:parameter name=use-connection value=dataSource / /map:transform map:transform src=stylesheets/homepage-sql2xml.xsl/ map:transform type=i18n map:parameter name=locale value={jexl:cocoon.request.lang} / map:parameter name=bundle value=COB-INF/files/translations / /map:transform map:transform src=stylesheets/homepage2html.xsl/ etc... Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it Yes, it's really simple. The source file is an xml file with a sqltransformer query. The query is simple: just a select to a specific table (or view) with a where condition. Then an xsl transformer convert the xml to txt with a pair of key and value for every row. That's all. map:pipeline internal-only=true map:match pattern=translations_*.properties map:generate type=string-template src=files/dbdata.xml map:parameter name=table value=messages/ map:parameter name=fields value=key_value, value/ map:parameter name=condition value=lang_id='{map:1}'/ map:parameter name=orderfields value=1/ map:parameter name=rowcount value=10/ /map:generate map:transform type=sql map:parameter name=use-connection value=dataSource / /map:transform map:transform src=stylesheets/sql2properties.xsl/ map:serialize type=txt/ /map:match This is a snip of the xsl stylesheet: xsl:template match=sql:row xsl:text xsl:value-of select=sql:key_value//xsl:text xsl:text=/xsl:text xsl:textxsl:value-of select=sql:value//xsl:text /xsl:template Alberto On Fri, 2014-01-17 at 15:30 +0100, gelo1234 wrote: Can you show here your full original Cocoon pipeline ? Do you store property files content or property filenames inside db ? Greetings, Greg 2014/1/17 Alberto Brosich abros...@ogs.trieste.it