cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KOZLOV Roman <r-koz...@opencascade.com>
Subject Re: Problems with SQLTransformer
Date Fri, 09 Aug 2002 15:55:07 GMT
Hi,

Could you try to add to your xsl a template for the root node like this:
<xsl:template match="/">
        <xsl:apply-templates/>
</xsl:template>

or just modify the template for rowset like this:
<xsl:template match="/rowset">
        <xsl:apply-templates/>
</xsl:template>

Roman

Albert Cervera Areny wrote:

> Hi,
>
> This is what I receive after the SQLTransform when I look it through the
> browser (option view source code)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <rowset>
> <row>
> <id>081778</id>
> <role/>
> <nom>name</nom>
> <passwd>paswd</passwd>
> <programa>progname</programa>
> </row>
> </rowset>
>
> After the XSLTransform, the browser gives an error (because no initial tag
> in the xml file) and if I look at the source code of the page I see:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> 081778namepassdprogname
>
> About the usuaris.xsl it is quite simple:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
>
> <xsl:stylesheet version="1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="rowset">
>         <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="row">
>         <authentication>
>                 <ID><xsl:value-of select="id"/></ID>
>                 <role><xsl:value-of select="role"/></role>
>                 <data>
>                         <xsl:copy-of select="nom"/>
>                         <xsl:copy-of select="programa"/>
>                         <xsl:copy-of select="instruccions"/>
>                 </data>
>         </authentication>
> </xsl:template>
> </xsl:stylesheet>
>
> > Your step a) makes it sound like this has nothing to do with SQL
> > transformer - that's the step that works unless I misunderstand you.
> > When you say you see only data and no xml tags in the browser that
> > sounds like a common non-problem I see all the time.  A few questions:
> > 1) Are the tags there when you do View Source in your browser?
> > 2) When in e) you say modifications have no effect do you mean that if
> > you literally re-arrange or remove items from the final output those
> > changes are not reflected?
>
> I mean that if instead of the above code I put the following for usuaris.xsl:
> <?xml version="1.0" encoding="iso-8859-1"?>
>
> <xsl:stylesheet version="1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> </xsl:stylesheet>
>
> Or
>
> <?xml version="1.0" encoding="iso-8859-1"?>
>
> <xsl:stylesheet version="1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="rowset">
>    hello
> </xsl:template>
> </xsl:stylesheet>
>
> The output is exactly the same!
>
> > 3) Have you ensured that any namespaces in use are not the problem? (the
> > xsl is looking for <foo> but is finding <ns:foo> ?)
> >
> > Geoff Howard
> >
> >> -----Original Message-----
> >> From: Albert Cervera Areny [mailto:informatic@sedifa.com]
> >> Sent: Friday, August 09, 2002 10:01 AM
> >> To: cocoon-users@xml.apache.org
> >> Subject: Problems with SQLTransformer
> >>
> >>
> >> Hi,
> >>   I start a new thread about it because the problem deserves
> >> this and I'm
> >> desperate ;-)
> >>
> >> <map:generate src="docs/consulta.xml"/>
> >> <map:transform type="sql">
> >>   <map:parameter name="use-connection" value="cocoon"/>
> >> </map:transform>
> >> <map:transform src="stylesheets/usuaris.xsl"/>
> >> <map:serialize type="xml"/>
> >>
> >> Looking at the source code of the generated xml with the browser I see
> >> only data no xml tags. Only the initial one: <?xml ....>
> >> I've been making some changes and it seems like after the
> >> SQLTransform I
> >> can't put a XSLTransform. I've tried the following things:
> >>    a) Take off the XSL transform and the result is correct.
> >> The data I get
> >> can be processed with xalan and usuaris.xsl and I get a new
> >> well formed
> >> XML file.
> >>    b) Change the name of usuaris.xsl (just in case I was modifing the
> >> wrong one) and it gives an error as cocoon can't find the file.
> >>    c) Leave usuaris.xsl empty and It gives an error.
> >>    d) Only leave the initial and final xsl:stylesheet tags
> >> and the output
> >> is the same.
> >>    e) Various modifications in the xsl file but does not seem
> >> to affect to
> >> the output unless it is bad formed, then it gives an error.
> >> So the file
> >> is processed but incorrectly?
> >>
> >> I don't know if it might be a bug or I'm really doing something very
> >> wrong, but it should be pretty stright forward, shouldn't it?
> >>
> >> Well... thanks for your patience ;-)
> >>
> >>
> >> > Thanks! It worked without problems!
> >> >
> >> > But of  course I couldn't wait until having another problem ;-) The
> >> thing is that I'm trying to make this work:
> >> >
> >> > sitemap.xmap:
> >> >
> >> > <map:generate src="docs/usuaris.xml"/>
> >> > <map:transform src="stylesheets/usuaris.xsl">
> >> >     <map:parameter name="use-request-parameters" value="true"/>
> >> > </map:transform>
> >> > <map:transform type="sql">
> >> >     <map:parameter name="use-connection" value="cocoon"/>
> >> > </map:transform>
> >> > <map:transform src="stylesheets/usuaris.xsl"/>
> >> > <map:serialize type="xml"/>
> >> >
> >> > While debugging I commented the last transform and data arrives as I
> >> expect. In fact, I save the xml generated file with the browser and
> >> process it with xalan using the usuaris.xsl and it works!
> >> But if I use
> >> > this transform in the sitemap I get all the fields returned
> >> but without
> >> > any XML tags. (It should return as xalan all the authentication XML
> >> structure)
> >> >
> >> > Yes I know I'm using the same stylesheet twice but its for an
> >> > authentication process and It should work :-)
> >> >
> >> > The strange thing is that last step <map:transform
> >> > src="stylesheets/usuaris.xsl"/>. Any clue?
> >> >
> >> > Thanks, once again!
> >> >
> >> > PS: I believe, after so many problems, some day I will be
> >> able to answer
> >> > all the questions in this list ;-) May be a new Trivial
> >> Pursuit about
> >> > cocoon? That
> >> >
> >> >
> >> > On Thursday 08 August 2002 14:33, Vadim Gritsenko wrote:
> >> >> > From: Albert Cervera Areny [mailto:informatic@sedifa.com]
> >> >> >
> >> >> > I get the following error while trying to connect to a postgresql
> >> >>
> >> >> database
> >> >>
> >> >> > throw the SQLTransformer:
> >> >> >
> >> >> > java.sql.SQLException: No suitable driver
> >> >> >
> >> >> > I've seen in the list archives that it's been reported
> >> various times
> >> >>
> >> >> but
> >> >>
> >> >> > none of the solutions seems to correct my problem.
> >> >> >
> >> >> > web.xml:
> >> >> >
> >> >> >   <init-param>
> >> >> >     <param-name>load-class</param-name>
> >> >> >     <param-value>
> >> >> >       org.postgresql.Driver
> >> >> >     </param-value>
> >> >> >   </init-param>
> >> >> >   <init-param>
> >> >> >     <param-name>extra-classpath</param-name>
> >> >> >     <param-value>/usr/share/java/postgresql.jar</param-value>
> >> >>
> >> >> AFAIR, this will not work and has different purpose.
> >> >>
> >> >> Please jar under WEB-INF/lib.
> >> >>
> >> >> Vadim
> >> >>
> >> >>    </init-param>
> >> >>
> >> >> > cocoon.xconf:
> >> >> >
> >> >> > <datasources>
> >> >> >      <jdbc logger="core.datasources.postgres" name="cocoon">
> >> >> >             <pool-controller max="10" min="5"/>
> >> >> >             <driver>org.postgresql.Driver</driver>
> >> >> >
> >> <dburl>jdbc:postgresql://localhost/cocoon:5432</dburl>
> >> >> <user>cocoon</user>
> >> >> >             <password>password</password>
> >> >> >      </jdbc>
> >> >> > </datasources>
> >> >> >
> >> >> > I don't know if org.postgresql.Driver is necessari in
> >> both files but
> >> >> I started I've tried it in just one of them and doesn't work
> >> >> neighter. Of course access to the database is enabled
> >> correctly, the
> >> >> port is
> >> >>
> >> >> 5432 as
> >> >>
> >> >> > NMAP says ;) and I can connect from psql. All connection
> >> data seems
> >> >> to
> >> >>
> >> >> be
> >> >>
> >> >> > correct... Any other ideas??
> >> >> >
> >> >> >
> >> >> > Thanks!
> >> >> >
> >> >> > Albert Cervera Areny
> >> >>
> >> >>
> >> ---------------------------------------------------------------------
> >> >> Please check that your question  has not already been
> >> answered in the
> >> >> FAQ before posting.
> >> <http://xml.apache.org/cocoon/faq/index.html>
> >> >>
> >> >> To unsubscribe, e-mail:
> >> <cocoon-users-unsubscribe@xml.apache.org>
> >> >> For additional commands, e-mail:
> >> <cocoon-users-help@xml.apache.org>
> >> >
> >> > --
> >> > Albert Cervera Areny
> >> > Dept. Informàtica Sedifa, S.L.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> ---------------------------------------------------------------------
> >> > Please check that your question  has not already been
> >> answered in the
> >> > FAQ before posting.
> >> <http://xml.apache.org/cocoon/faq/index.html>
> >> >
> >> > To unsubscribe, e-mail:
> >> <cocoon-users-unsubscribe@xml.apache.org>
> >> > For additional commands, e-mail:
> >> <cocoon-users-help@xml.apache.org>
> >>
> >>
> >> --
> >> Albert Cervera Areny
> >> Dept. Informàtica Sedifa, S.L.
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> Please check that your question  has not already been answered in the
> >> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> >>
> >> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> >> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> >>
> >
> > ---------------------------------------------------------------------
> > Please check that your question  has not already been answered in the
> > FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> > For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>
> --
> Albert Cervera Areny
> Dept. Informàtica Sedifa, S.L.
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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


Mime
View raw message