You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Niels van Kampenhout <n....@hippo.nl> on 2005/03/24 09:56:28 UTC

Multiple ancestor queries on the same level not supported by SQLTransformer?

[I posted this on the user list yesterday, but since no one replied I try it here too...]

Is it possible to have more than one ancestor query in the input XML for the SQLTransformer? I don't see any reason why it shouldn't be, but I cannot get it to work.

Example:

The query

<page xmlns:sql="http://apache.org/cocoon/SQL/2.0">
  <sql:execute-query>
    <sql:query name="person"> 
      select id, name, email, frequency from person; 
    </sql:query>
    <sql:execute-query>
      <sql:query name="themes"> 
        select theme
        from person_theme 
        where personid = <sql:ancestor-value sql:level="1" sql:name="person.id"/>;
      </sql:query>
    </sql:execute-query>
    <sql:execute-query>
      <sql:query name="types"> 
        select type 
        from person_type 
        where personid = <sql:ancestor-value sql:level="1" sql:name="person.id"/>;
      </sql:query>
    </sql:execute-query>
  </sql:execute-query>
</page>

returns

<page xmlns:sql="http://apache.org/cocoon/SQL/2.0"></page>

while

<page xmlns:sql="http://apache.org/cocoon/SQL/2.0">
  <sql:execute-query>
    <sql:query name="person"> 
      select id, name, email, frequency from person; 
    </sql:query>
    <sql:execute-query>
      <sql:query name="themes"> 
        select theme
        from person_theme 
        where personid = <sql:ancestor-value sql:level="1" sql:name="person.id"/>;
      </sql:query>
    </sql:execute-query>
  </sql:execute-query>
</page>

returns the result of the SQL queries as it should.

Is this functionality simply not supported by the SQLTransformer, or is my input XML incorrect? Maybe I misinterpreted the meaning of the level attribute?

Niels