hi richard,
 
well, what can I say... the xsl not only looks complicated, it looks like a mess ;-)  you should really, really (really ;-) read up on the technologies you're trying to use.
 
1. what do you need the DTD for?
2. why are you trying to handle elements which are supposed to be handled by the sql transformer (which in this case couldn't even work because you're not matching the correspondig namespace)?
3. in which sequence are transformations applied? (sql transformer -> your stylesheet, or vice versa?)
 
just a guess; starting from your database.xml you want to have an sql query executed and the query results formatted by your database.xsl.
 
then please do it like that. generate (database.xml) -> transform (sql) -> transform (database.xsl) -> serialize (html?)
 
you're not even trying to handle the query results (in database.xml I only see a query defined, but the results are handled nowhere). you seem to be assuming the results are coming from somewhere and are trying to handle them within your stylesheet. please read the accompanying docs; it would save you and those trying to help you time and struggles.
 
just to get you started; to handle the results you would insert appropriate statements within the <sql:execute-query> element to generate e.g. elements which contain the data you want to transform/style/serialize;
 
example (top off my head, based on esql logicsheet);
...
<sql:execute-query>
    <sql:query>
        SELECT artistbandname, generalmusictitle FROM artistband
    </sql:query>
 
    <sql:results>
    <sql:row-results>
        <mydata>
            <name><sql:get-string column="artistbandname"/></name>
            <title><sql:get-string column="generalmusictitle"/></title>
        </mydata>
    </sql:row-results>
    </sql:results>
</sql:execute-query>
...
 
then after the sql transformer step the corresponding data will be available in the SAX event stream which you can then handle from within your stylesheet.
 
 
ok, let's get to the stylesheet:
 
 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:sql="http://apache.org/cocoon/SQL/2.0">
 
> <xsl:template match="/">
> <html>
> <head/>
> <body>
> <img src=""/>
> <title>soundpool</title>
 
the <title> element should go into the <head> element.
 
> <xsl:for-each select="/">
 
what is this supposed to do? for each document root? there's only one document root.
 
> <table border="0" width="99%">
> <xsl:if test="position()=1">
> <xsl:text disable-output-escaping="yes">&lt;tbody&gt;</xsl:text>
> </xsl:if>
 
is that if test on the document root? why aren't you just creating the table body via <tbody>?
 
> <tr>
> <td align="right">
> <xsl:for-each select="pda">
> <span >
> <xsl:for-each select="title">
> <span >
> <span >
> <xsl:apply-templates/>
> </span>
> </span>
> </xsl:for-each>
> </span>
> </xsl:for-each>
> </td>
> </tr>
 
nesting mess, huh? ;-)
 
> <xsl:if test="position()=last()">
> <xsl:text disable-output-escaping="yes">&lt;/tbody&gt;</xsl:text>
> </xsl:if>
> </table>
 
again, why not </tbody>?
 
<snip/>
 
<!-- MySQL Query -->
 
here you would handle the data produced by the sql transformer step.
 
<snip/>
 
my last advice; read the docs, please.
 
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]Im Auftrag von Richard Cunliffe
Gesendet: Mittwoch, 12. März 2003 18:47
An: [EMAIL PROTECTED]
Betreff: RE: SQL RE: 2 (should be) easy questions

Thorsten,

 

Ok the following statement is trying to display the results of the query from the MySQL database in a table, I don’t know if this is right.

 

What are you trying to do with, anyway:

<xsl:for-each select="query">
 <xsl:for-each select="execute-query">
  <xsl:apply-templates/>
 </xsl:for-each>
</xsl:for-each>

 

 

The code looks complicated, because I am using XML Spy designer which allows you to put together your style sheet visually, with the aid of the DTD. The code above was the XML Spy’s way of trying to represent it from the DTD.

 

I have attached my xml, xsl, and dtd for you to have a look at to get a better understanding.

 

Many thanks,

 

Richard.

 

Reply via email to