You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Katharina Weimer <ka...@gmx.de> on 2003/10/30 10:19:46 UTC

Connecting Cocoon 2.1 with eXist 0.9.2 ???

Hi everyone,

I'mquite new to Cocoon and having difficulties in connecting to eXist from
Cocoon 2.1.
I'm not that sure if I did anything right - I would appreciate it very much
if anyone could have a look at it....

Ok, I'm using exist 0.9.2, Tomcat 4.1.27 and Cocoon 2.1 .
I have files like that in the database under /db/addressbook:

<?xml version="1.0" encoding="UTF-8"?>
<contacts xmlns:exist="http://exist.sourceforge.net/NS/exist">
    <contact id="hermann">
        <name>Hermann Lang</name>
        <address>
            <street>Himmelweg</street>
            <number/>
            <city>Echterdingen</city>
            <postalcode>70771</postalcode>
        </address>
    </contact>
    <contact id="ilse">
        <name>Ilse Honig</name>
        <address>
            <street>Wollkengasse</street>
            <number>15</number>
            <city>Wünschelbrunn</city>
            <postalcode>55555</postalcode>
        </address>
    </contact>
</contacts>


My sitemap.xmap looks like this:
...
<map:transformer name="exist_xmldb"
src="org.apache.cocoon.transformation.XMLDBTransformer">
<driver>org.exist.xmldb.DatabaseImpl</driver>
<base>xmldb:exist://localhost:8080/exist/xmlrpc/db/</base>
</map:transformer>
...
 
...
<map:match pattern="adressen">
<map:generate src="TEST/xml/samples/adressen.xml"/>
<map:transform type="exist_xmldb">
<map:parameter name="base"
value="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook"/>
</map:transform>
<map:transform src="TEST/xsl/samples/simple2.xsl"/>
<map:serialize encoding="UTF-8" type="html"/>
</map:match>
...
 

adressen.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<document>
    <body>
    <section title="Datenbankabfragen">
 
    <exist_xmldb:collection
xmlns:exist_xmldb="http://exist-db.org/transformer/1.0" uri="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook">
 
 <chapter> 
    <exist_xmldb:execute>
 
    <exist_xmldb:path> //adress </exist_xmldb:path>
 
    <p>   Found <exist_xmldb:get-hit-count/> hits   </p>
 
     <exist_xmldb:results>
        <exist_xmldb:get-xml as="string"/>
     </exist_xmldb:results>
 
        </exist_xmldb:execute>
    </chapter> 
</exist_xmldb:collection> 
 
</section>
</body>
</document>



simple2.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
 
<xsl:template match="document">
    <html>    
        <head>
            <title>
                <xsl:value-of select="body/section/@title"/>
            </title>
         </head>
        <body bgcolor="#FFFFFF">
            <table width="100%" border="0" cellpadding="10" cellspacing="0">
                <tr valign="center">
                    <td valign="bottom">
                            <xsl:value-of select="body/section/@title"/>
                    </td>
                    <td valign="bottom">
                             <xsl:value-of
select="body/section/chapter/text()"/>
                    </td>
                </tr>
                <tr valign="center">
                        <td valign="bottom">
                        </td>
                        <td valign="bottom">
                        </td>    
                </tr>
            </table>
        </body>
    </html>
</xsl:template>
</xsl:stylesheet>


When I'm starting that, I just get an HTML-page...but without any results..

Does anyone have clue what I'm doin' wrong?
..I'm getting desperated...

Thanks very much in advance.....
Katharina

-- 
HAKUNA MATATA !!!

NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++


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


Re: Connecting Cocoon 2.1 with eXist 0.9.2 ???

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
You will need to add the namespace xmlns:exist_xmldb="http://exist-db.org/transformer/1.0 to the top of your xsl 
document otherwise the transformation will ignore them.

I'll try and replicate your sitemap on my test system as it is difficult to see the exact problem from sight.

Regards,

Paull.

--
Paul Bowler
Aventix Associates Ltd

---------- Original Message -----------
From: "Katharina Weimer" <ka...@gmx.de>
To: users@cocoon.apache.org
Sent: Thu, 30 Oct 2003 11:31:23 +0100 (MET)
Subject: Re: Connecting Cocoon 2.1 with eXist 0.9.2 ???

> You're right - trying to test each transformation in turn makes more sense
> and shows errors earlier...
> 
> But when I'm doing this the XML- File I'm getting is the following:
> 
>   <?xml version="1.0" encoding="UTF-8" ?> 
>  <document>
>     <body>
>        <section title="Datenbankabfragen">
>  
>          <exist_xmldb:collection
> xmlns:exist_xmldb="http://exist-db.org/transformer/1.0"             
> uri="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook">
>             <chapter>
>                  <exist_xmldb:execute>
>                      <exist_xmldb:path>//adress</exist_xmldb:path> 
>                       <p>  Found  <exist_xmldb:get-hit-count />   hits  
> </p>
>                          <exist_xmldb:results>
>                                <exist_xmldb:get-xml as="string" /> 
>                           </exist_xmldb:results>
>                   </exist_xmldb:execute>
>             </chapter>
>         </exist_xmldb:collection>
>      </section>
>    </body>
>   </document>
> 
> ...so it seems, that the tags exist_xmldb:** are not "solved"..
> What do I have to change, that this works ?
> 
> BTW: Thanks a lot so far !
> 
> > When debugging things like this (I also used exist a lot) I find it best
> > to test each transformation in turn.
> > 
> > Try changing your sitemap match to:
> > 
> > <map:match pattern="adressen">
> >     <map:generate src="TEST/xml/samples/adressen.xml"/>
> >     <map:transform type="exist_xmldb">
> >         <map:parameter name="base"
> > value="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook"/>
> >     </map:transform>
> >     <!--
> >     <map:transform src="TEST/xsl/samples/simple2.xsl"/>
> >     -->
> >     <map:serialize type="xml"/>
> > </map:match>
> > 
> > This will show you what comes back from the exist call. You are probably
> > not receiving back what you think.
> > 
> > Regards,
> > 
> > Paul.
> > 
> > --
> > Paul Bowler
> > Aventix Associates Ltd
> > 
> > ---------- Original Message -----------
> > From: "Katharina Weimer" <ka...@gmx.de>
> > To: "'users@cocoon.apache.org'" <us...@cocoon.apache.org>
> > Sent: Thu, 30 Oct 2003 10:19:46 +0100 (MET)
> > Subject: Connecting Cocoon 2.1 with eXist 0.9.2 ???
> > 
> > > Hi everyone,
> > > 
> > > I'mquite new to Cocoon and having difficulties in connecting to eXist
> > from
> > > Cocoon 2.1.
> > > I'm not that sure if I did anything right - I would appreciate it very
> > much
> > > if anyone could have a look at it....
> > > 
> > > Ok, I'm using exist 0.9.2, Tomcat 4.1.27 and Cocoon 2.1 .
> > > I have files like that in the database under /db/addressbook:
> > > 
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <contacts xmlns:exist="http://exist.sourceforge.net/NS/exist">
> > >     <contact id="hermann">
> > >         <name>Hermann Lang</name>
> > >         <address>
> > >             <street>Himmelweg</street>
> > >             <number/>
> > >             <city>Echterdingen</city>
> > >             <postalcode>70771</postalcode>
> > >         </address>
> > >     </contact>
> > >     <contact id="ilse">
> > >         <name>Ilse Honig</name>
> > >         <address>
> > >             <street>Wollkengasse</street>
> > >             <number>15</number>
> > >             <city>Wünschelbrunn</city>
> > >             <postalcode>55555</postalcode>
> > >         </address>
> > >     </contact>
> > > </contacts>
> > > 
> > > My sitemap.xmap looks like this:
> > > ...
> > > <map:transformer name="exist_xmldb"
> > > src="org.apache.cocoon.transformation.XMLDBTransformer">
> > > <driver>org.exist.xmldb.DatabaseImpl</driver>
> > > <base>xmldb:exist://localhost:8080/exist/xmlrpc/db/</base>
> > > </map:transformer>
> > > ...
> > >  
> > > ...
> > > <map:match pattern="adressen">
> > > <map:generate src="TEST/xml/samples/adressen.xml"/>
> > > <map:transform type="exist_xmldb">
> > > <map:parameter name="base"
> > > value="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook"/>
> > > </map:transform>
> > > <map:transform src="TEST/xsl/samples/simple2.xsl"/>
> > > <map:serialize encoding="UTF-8" type="html"/>
> > > </map:match>
> > > ...
> > >  
> > > 
> > > adressen.xml
> > > 
> > > <?xml version="1.0" encoding="iso-8859-1"?>
> > > <document>
> > >     <body>
> > >     <section title="Datenbankabfragen">
> > >  
> > >     <exist_xmldb:collection
> > > xmlns:exist_xmldb="http://exist-db.org/transformer/1.0" 
> > uri="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook">
> > >  
> > >  <chapter> 
> > >     <exist_xmldb:execute>
> > >  
> > >     <exist_xmldb:path> //adress </exist_xmldb:path>
> > >  
> > >     <p>   Found <exist_xmldb:get-hit-count/> hits   </p>
> > >  
> > >      <exist_xmldb:results>
> > >         <exist_xmldb:get-xml as="string"/>
> > >      </exist_xmldb:results>
> > >  
> > >         </exist_xmldb:execute>
> > >     </chapter> 
> > > </exist_xmldb:collection> 
> > >  
> > > </section>
> > > </body>
> > > </document>
> > > 
> > > simple2.xsl
> > > 
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > > version="1.0">
> > >  
> > > <xsl:template match="document">
> > >     <html>    
> > >         <head>
> > >             <title>
> > >                 <xsl:value-of select="body/section/@title"/>
> > >             </title>
> > >          </head>
> > >         <body bgcolor="#FFFFFF">
> > >             <table width="100%" border="0" cellpadding="10"
> > cellspacing="0">
> > >                 <tr valign="center">
> > >                     <td valign="bottom">
> > >                             <xsl:value-of select="body/section/@title"/>
> > >                     </td>
> > >                     <td valign="bottom">
> > >                              <xsl:value-of
> > > select="body/section/chapter/text()"/>
> > >                     </td>
> > >                 </tr>
> > >                 <tr valign="center">
> > >                         <td valign="bottom">
> > >                         </td>
> > >                         <td valign="bottom">
> > >                         </td>    
> > >                 </tr>
> > >             </table>
> > >         </body>
> > >     </html>
> > > </xsl:template>
> > > </xsl:stylesheet>
> > > 
> > > When I'm starting that, I just get an HTML-page...but without any
> > results..
> > > 
> > > Does anyone have clue what I'm doin' wrong?
> > > ..I'm getting desperated...
> > > 
> > > Thanks very much in advance.....
> > > Katharina
> > > 
> > > -- 
> > > HAKUNA MATATA !!!
> > > 
> > > NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
> > > Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
> > > 
> > > Jetzt kostenlos anmelden unter http://www.gmx.net
> > > 
> > > +++ GMX - die erste Adresse für Mail, Message, More! +++
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > ------- End of Original Message -------
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> 
> -- 
> HAKUNA MATATA !!!
> 
> NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
> Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
> 
> Jetzt kostenlos anmelden unter http://www.gmx.net
> 
> +++ GMX - die erste Adresse für Mail, Message, More! +++
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
------- End of Original Message -------


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


Re: Connecting Cocoon 2.1 with eXist 0.9.2 ???

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
Katharina,

I have taken your source and modofied it to the way I use exist.

My site map fragment reads:

<!-- test -->
<map:pipeline>
	<map:match pattern="test.html">
		<map:generate src="xmldb:exist://localhost/exist/xmlrpc/db/addressbook/contacts.xml"/>
		<map:transform src="simple.xslt"/>
		<map:serialize type="html"/>
	</map:match>
</map:pipeline>

I grab the data from exist using the XMLDB protocol in a generator. Your contact list is stored in the addressbook 
collection with name contacts.xml. Personally I would store each contact under a different file called {id}.xml so you 
can take advantage of exists search capability whilst making insters/updates/deletes much simpler as you are dealing 
with seperate files.

The XML returned from exist reads:

  <?xml version="1.0" encoding="UTF-8" ?> 
  <contacts xmlns:exist="http://exist.sourceforge.net/NS/exist">
    <contact id="hermann">
      <name>Hermann Lang</name> 
      <address>
        <street>Himmelweg</street> 
        <number /> 
        <city>Echterdingen</city> 
        <postalcode>70771</postalcode> 
      </address>
    </contact>
    <contact id="ilse">
      <name>Ilse Honig</name> 
      <address>
        <street>Wollkengasse</street> 
        <number>15</number> 
        <city>Wunschelbrunn</city> 
        <postalcode>55555</postalcode> 
      </address>
    </contact>
  </contacts>

The xslt document to show this as HTML reads:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="contacts">
	<html>    
		<head>
			<title>Contact List</title>
		</head>
		<body bgcolor="#FFFFFF">
			<table border="1">
				<tr>
					<th colspan="5">Contact List</th>
				</tr>
				<xsl:apply-templates select="contact"/>
			</table>
		</body>
	</html>
</xsl:template>
<xsl:template match="contact">
	<tr>
		<td><xsl:value-of select="@id"/></td>
		<td><xsl:value-of select="address/street"/></td>
		<td><xsl:value-of select="address/number"/></td>
		<td><xsl:value-of select="address/city"/></td>
		<td><xsl:value-of select="address/postalcode"/></td>
	</tr>
</xsl:template>

</xsl:stylesheet>

As you can see this is not complex, but you need to make sure you match on the root node of the xml document that is 
returned from exist.

To get the XMLDB protocol working within the sitemap you must make sure you have:

<!-- xmldb pseudo protocol -->
<component-instance class="org.apache.cocoon.components.source.impl.XMLDBSourceFactory" name="xmldb">
    <!-- exist driver -->
    <driver class="org.exist.xmldb.DatabaseImpl" type="exist"/>
</component-instance>

... in the cocoon configuration file, under WEB-INF/cocoon.xconf in your cocoon web application directory.

I'm sorry I can't help with the xmldb transformer, but I feel the xmldb protocol is much more powerful, and I hope 
this simple example helps you.

Paul.

--
Paul Bowler
Aventix Associates Ltd


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


Re: Connecting Cocoon 2.1 with eXist 0.9.2 ???

Posted by Katharina Weimer <ka...@gmx.de>.
You're right - trying to test each transformation in turn makes more sense
and shows errors earlier...

But when I'm doing this the XML- File I'm getting is the following:

  <?xml version="1.0" encoding="UTF-8" ?> 
 <document>
    <body>
       <section title="Datenbankabfragen">
 
         <exist_xmldb:collection
xmlns:exist_xmldb="http://exist-db.org/transformer/1.0"             
uri="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook">
            <chapter>
                 <exist_xmldb:execute>
                     <exist_xmldb:path>//adress</exist_xmldb:path> 
                      <p>  Found  <exist_xmldb:get-hit-count />   hits  
</p>
                         <exist_xmldb:results>
                               <exist_xmldb:get-xml as="string" /> 
                          </exist_xmldb:results>
                  </exist_xmldb:execute>
            </chapter>
        </exist_xmldb:collection>
     </section>
   </body>
  </document>

...so it seems, that the tags exist_xmldb:** are not "solved"..
What do I have to change, that this works ?

BTW: Thanks a lot so far !



> When debugging things like this (I also used exist a lot) I find it best
> to test each transformation in turn.
> 
> Try changing your sitemap match to:
> 
> <map:match pattern="adressen">
>     <map:generate src="TEST/xml/samples/adressen.xml"/>
>     <map:transform type="exist_xmldb">
>         <map:parameter name="base"
> value="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook"/>
>     </map:transform>
>     <!--
>     <map:transform src="TEST/xsl/samples/simple2.xsl"/>
>     -->
>     <map:serialize type="xml"/>
> </map:match>
> 
> This will show you what comes back from the exist call. You are probably
> not receiving back what you think.
> 
> Regards,
> 
> Paul.
> 
> --
> Paul Bowler
> Aventix Associates Ltd
> 
> ---------- Original Message -----------
> From: "Katharina Weimer" <ka...@gmx.de>
> To: "'users@cocoon.apache.org'" <us...@cocoon.apache.org>
> Sent: Thu, 30 Oct 2003 10:19:46 +0100 (MET)
> Subject: Connecting Cocoon 2.1 with eXist 0.9.2 ???
> 
> > Hi everyone,
> > 
> > I'mquite new to Cocoon and having difficulties in connecting to eXist
> from
> > Cocoon 2.1.
> > I'm not that sure if I did anything right - I would appreciate it very
> much
> > if anyone could have a look at it....
> > 
> > Ok, I'm using exist 0.9.2, Tomcat 4.1.27 and Cocoon 2.1 .
> > I have files like that in the database under /db/addressbook:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <contacts xmlns:exist="http://exist.sourceforge.net/NS/exist">
> >     <contact id="hermann">
> >         <name>Hermann Lang</name>
> >         <address>
> >             <street>Himmelweg</street>
> >             <number/>
> >             <city>Echterdingen</city>
> >             <postalcode>70771</postalcode>
> >         </address>
> >     </contact>
> >     <contact id="ilse">
> >         <name>Ilse Honig</name>
> >         <address>
> >             <street>Wollkengasse</street>
> >             <number>15</number>
> >             <city>Wünschelbrunn</city>
> >             <postalcode>55555</postalcode>
> >         </address>
> >     </contact>
> > </contacts>
> > 
> > My sitemap.xmap looks like this:
> > ...
> > <map:transformer name="exist_xmldb"
> > src="org.apache.cocoon.transformation.XMLDBTransformer">
> > <driver>org.exist.xmldb.DatabaseImpl</driver>
> > <base>xmldb:exist://localhost:8080/exist/xmlrpc/db/</base>
> > </map:transformer>
> > ...
> >  
> > ...
> > <map:match pattern="adressen">
> > <map:generate src="TEST/xml/samples/adressen.xml"/>
> > <map:transform type="exist_xmldb">
> > <map:parameter name="base"
> > value="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook"/>
> > </map:transform>
> > <map:transform src="TEST/xsl/samples/simple2.xsl"/>
> > <map:serialize encoding="UTF-8" type="html"/>
> > </map:match>
> > ...
> >  
> > 
> > adressen.xml
> > 
> > <?xml version="1.0" encoding="iso-8859-1"?>
> > <document>
> >     <body>
> >     <section title="Datenbankabfragen">
> >  
> >     <exist_xmldb:collection
> > xmlns:exist_xmldb="http://exist-db.org/transformer/1.0" 
> uri="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook">
> >  
> >  <chapter> 
> >     <exist_xmldb:execute>
> >  
> >     <exist_xmldb:path> //adress </exist_xmldb:path>
> >  
> >     <p>   Found <exist_xmldb:get-hit-count/> hits   </p>
> >  
> >      <exist_xmldb:results>
> >         <exist_xmldb:get-xml as="string"/>
> >      </exist_xmldb:results>
> >  
> >         </exist_xmldb:execute>
> >     </chapter> 
> > </exist_xmldb:collection> 
> >  
> > </section>
> > </body>
> > </document>
> > 
> > simple2.xsl
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > version="1.0">
> >  
> > <xsl:template match="document">
> >     <html>    
> >         <head>
> >             <title>
> >                 <xsl:value-of select="body/section/@title"/>
> >             </title>
> >          </head>
> >         <body bgcolor="#FFFFFF">
> >             <table width="100%" border="0" cellpadding="10"
> cellspacing="0">
> >                 <tr valign="center">
> >                     <td valign="bottom">
> >                             <xsl:value-of select="body/section/@title"/>
> >                     </td>
> >                     <td valign="bottom">
> >                              <xsl:value-of
> > select="body/section/chapter/text()"/>
> >                     </td>
> >                 </tr>
> >                 <tr valign="center">
> >                         <td valign="bottom">
> >                         </td>
> >                         <td valign="bottom">
> >                         </td>    
> >                 </tr>
> >             </table>
> >         </body>
> >     </html>
> > </xsl:template>
> > </xsl:stylesheet>
> > 
> > When I'm starting that, I just get an HTML-page...but without any
> results..
> > 
> > Does anyone have clue what I'm doin' wrong?
> > ..I'm getting desperated...
> > 
> > Thanks very much in advance.....
> > Katharina
> > 
> > -- 
> > HAKUNA MATATA !!!
> > 
> > NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
> > Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
> > 
> > Jetzt kostenlos anmelden unter http://www.gmx.net
> > 
> > +++ GMX - die erste Adresse für Mail, Message, More! +++
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> ------- End of Original Message -------
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
HAKUNA MATATA !!!

NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++


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


Re: Connecting Cocoon 2.1 with eXist 0.9.2 ???

Posted by Paul Bowler <pa...@www.aventix.co.uk>.
When debugging things like this (I also used exist a lot) I find it best to test each transformation in turn.

Try changing your sitemap match to:

<map:match pattern="adressen">
    <map:generate src="TEST/xml/samples/adressen.xml"/>
    <map:transform type="exist_xmldb">
        <map:parameter name="base" value="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook"/>
    </map:transform>
    <!--
    <map:transform src="TEST/xsl/samples/simple2.xsl"/>
    -->
    <map:serialize type="xml"/>
</map:match>

This will show you what comes back from the exist call. You are probably not receiving back what you think.

Regards,

Paul.

--
Paul Bowler
Aventix Associates Ltd

---------- Original Message -----------
From: "Katharina Weimer" <ka...@gmx.de>
To: "'users@cocoon.apache.org'" <us...@cocoon.apache.org>
Sent: Thu, 30 Oct 2003 10:19:46 +0100 (MET)
Subject: Connecting Cocoon 2.1 with eXist 0.9.2 ???

> Hi everyone,
> 
> I'mquite new to Cocoon and having difficulties in connecting to eXist from
> Cocoon 2.1.
> I'm not that sure if I did anything right - I would appreciate it very much
> if anyone could have a look at it....
> 
> Ok, I'm using exist 0.9.2, Tomcat 4.1.27 and Cocoon 2.1 .
> I have files like that in the database under /db/addressbook:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <contacts xmlns:exist="http://exist.sourceforge.net/NS/exist">
>     <contact id="hermann">
>         <name>Hermann Lang</name>
>         <address>
>             <street>Himmelweg</street>
>             <number/>
>             <city>Echterdingen</city>
>             <postalcode>70771</postalcode>
>         </address>
>     </contact>
>     <contact id="ilse">
>         <name>Ilse Honig</name>
>         <address>
>             <street>Wollkengasse</street>
>             <number>15</number>
>             <city>Wünschelbrunn</city>
>             <postalcode>55555</postalcode>
>         </address>
>     </contact>
> </contacts>
> 
> My sitemap.xmap looks like this:
> ...
> <map:transformer name="exist_xmldb"
> src="org.apache.cocoon.transformation.XMLDBTransformer">
> <driver>org.exist.xmldb.DatabaseImpl</driver>
> <base>xmldb:exist://localhost:8080/exist/xmlrpc/db/</base>
> </map:transformer>
> ...
>  
> ...
> <map:match pattern="adressen">
> <map:generate src="TEST/xml/samples/adressen.xml"/>
> <map:transform type="exist_xmldb">
> <map:parameter name="base"
> value="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook"/>
> </map:transform>
> <map:transform src="TEST/xsl/samples/simple2.xsl"/>
> <map:serialize encoding="UTF-8" type="html"/>
> </map:match>
> ...
>  
> 
> adressen.xml
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <document>
>     <body>
>     <section title="Datenbankabfragen">
>  
>     <exist_xmldb:collection
> xmlns:exist_xmldb="http://exist-db.org/transformer/1.0" 
uri="xmldb:exist://localhost:8080/exist/xmlrpc/db/addressbook">
>  
>  <chapter> 
>     <exist_xmldb:execute>
>  
>     <exist_xmldb:path> //adress </exist_xmldb:path>
>  
>     <p>   Found <exist_xmldb:get-hit-count/> hits   </p>
>  
>      <exist_xmldb:results>
>         <exist_xmldb:get-xml as="string"/>
>      </exist_xmldb:results>
>  
>         </exist_xmldb:execute>
>     </chapter> 
> </exist_xmldb:collection> 
>  
> </section>
> </body>
> </document>
> 
> simple2.xsl
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>  
> <xsl:template match="document">
>     <html>    
>         <head>
>             <title>
>                 <xsl:value-of select="body/section/@title"/>
>             </title>
>          </head>
>         <body bgcolor="#FFFFFF">
>             <table width="100%" border="0" cellpadding="10" cellspacing="0">
>                 <tr valign="center">
>                     <td valign="bottom">
>                             <xsl:value-of select="body/section/@title"/>
>                     </td>
>                     <td valign="bottom">
>                              <xsl:value-of
> select="body/section/chapter/text()"/>
>                     </td>
>                 </tr>
>                 <tr valign="center">
>                         <td valign="bottom">
>                         </td>
>                         <td valign="bottom">
>                         </td>    
>                 </tr>
>             </table>
>         </body>
>     </html>
> </xsl:template>
> </xsl:stylesheet>
> 
> When I'm starting that, I just get an HTML-page...but without any results..
> 
> Does anyone have clue what I'm doin' wrong?
> ..I'm getting desperated...
> 
> Thanks very much in advance.....
> Katharina
> 
> -- 
> HAKUNA MATATA !!!
> 
> NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
> Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
> 
> Jetzt kostenlos anmelden unter http://www.gmx.net
> 
> +++ GMX - die erste Adresse für Mail, Message, More! +++
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
------- End of Original Message -------


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