You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Carlos Tejo Alonso <ca...@fundacionctic.org> on 2008/09/10 10:21:54 UTC

XSLT, databases and cocoon 2.2

Hello,

I have a .xml document with an <gap id="1"> element. I want to apply a
transformer (maybe and xslt) that convert this element into <xi:include
href="http://www.example.org">, where "http://www.example.org" is
obtained from a database "test", table "gap2xinclude", using the "id"
attribute of the "gap" element.

More or less:

* <gap id="1"> --[Transformer]--> <xi:include
href="http://www.example.org">

* Database test. Table gap2xinclude.
  id | href
  ---------------------------
   1 | http://www.example.org

How can I do it in cocoon 2.2?

Regards,

Carlos Tejo Alonso
R&D and Innovation Department
CTIC Foundation [Asturias, Spain]
www.fundacionctic.org

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


sitemap, action flow

Posted by Flemion Shafeeq <fl...@hulmail.harvard.edu>.
Hi,
I am using cocoon 2.1
and i have a sitemap in my application in which i have a certain action,
if the action succeeds, i need to transform a particular page.
the action returns a map and i have verified its not null,
but the generation doesnt happen,can anybody check if iam doing something 
wrong...

  <map:match pattern="huid-login">
                                 <map:act type="HUIDAuthenticationAction">
                                         <!-- Loggin suceeded, request will 
be forwarded.to the summary page-->
                                         <map:transform 
type="SubmitterGroupSummary"/>
                                         <map:serialize type="xml"/>
                                 </map:act>

                                 <!-- Login failed, try again. -->
                                 <map:transform type="HuidLogin"/>
                                 <map:serialize type="xml"/>
    </map:match>

The HUIDAuthenticationAction is returning a new Map, in case of successful 
action, but the SubmitterGroupSummary is not transformed..
i have declared the transformer, and action in map:components inside sitemap.

Any idea?

rgds
Flemion. 

RE: XSLT, databases and cocoon 2.2

Posted by Carlos Tejo Alonso <ca...@fundacionctic.org>.
Thanks for your answer.

> > I have a .xml document with an <gap id="1"> element. I want 
> to apply a
> > transformer (maybe and xslt) that convert this element into  
> > <xi:include
> > href="http://www.example.org">, where "http://www.example.org" is
> > obtained from a database "test", table "gap2xinclude", 
> using the "id"
> > attribute of the "gap" element.
> 
> I have not used it myself but I think you could use the SQL  
> transformer[1] which is part of the databases block[2].
> 
> XML:
>    <gap id="1"/>
> XSLT to add the database call:
>    <xsl:template match="gap>
>    <sql:execute-query>
>    ...
>    where id={@id}
>    ...
>    </> </>
> XSLT to convert result set into whatever format you need.

Just FYI, it works fine, but I have to added 2 transformations in the
sitemap (and in this order):

<map:transform src="gap2xinclude.xslt" type="xslt"/>
<map:transform src="gap2xinclude.xslt" type="sql">


Regards,

Carlos Tejo Alonso
R&D and Innovation Department
CTIC Foundation [Asturias, Spain]
www.fundacionctic.org 

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


Re: XSLT, databases and cocoon 2.2

Posted by Andre Thenot <an...@thenot.org>.
On Sep 10, 2008, at 4:21, Carlos Tejo Alonso wrote:

> I have a .xml document with an <gap id="1"> element. I want to apply a
> transformer (maybe and xslt) that convert this element into  
> <xi:include
> href="http://www.example.org">, where "http://www.example.org" is
> obtained from a database "test", table "gap2xinclude", using the "id"
> attribute of the "gap" element.

I have not used it myself but I think you could use the SQL  
transformer[1] which is part of the databases block[2].

XML:
   <gap id="1"/>
XSLT to add the database call:
   <xsl:template match="gap>
   <sql:execute-query>
   ...
   where id={@id}
   ...
   </> </>
XSLT to convert result set into whatever format you need.

HTH,

A.


[1] http://cocoon.apache.org/2.1/userdocs/sql-transformer.html
[2] http://cocoon.apache.org/2.2/blocks/databases/1.0/926_1_1.html

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