cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Brosich <abros...@ogs.trieste.it>
Subject Re: [C3] Can i18n transformer use an internal pipeline as bundle?
Date Fri, 17 Jan 2014 14:57:53 GMT

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="100000"/>
		</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:text><xsl: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 <abrosich@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-unsubscribe@cocoon.apache.org
>         For additional commands, e-mail: users-help@cocoon.apache.org
>         
> 
> 



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


Mime
View raw message