HI it's me again.

With this xml file I get the right chapters for the right sections and the right sections for the right document.
Only that my output is something like this
document
section A section B
chapter 1 chapter 2
chapter 3


I wanted to generate a document structure like this:
document
section A
chapter 1
chapter 2
section B
chapter 3



I have no idea if my way how to use  the esql -query is wrong or if I have change the xsl file.

But may some one just give me a hint ...

Thank you in advance ... 
J.

I will post again my xml and my xsl file. Sorry for this long posting.

myfile.xml

<?xml version="1.0" encoding="UTF-8"?>
<xsp:page laguage="java" xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2">
        <!-- Get Document -->
        <Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd" xmlns:esql="http://apache.org/cocoon/SQL/v2" xmlns:xsp="http://apache.org/xsp">


                <esql:connection>
                        <esql:pool>xmldb</esql:pool>
                        <xsp:logic> String document= "1";</xsp:logic>
                        <esql:execute-query>
                                <esql:query>select * from document where DocID=<xsp:expr>document</xsp:expr>
                                </esql:query>
                                <esql:results>
                                        <esql:row-results>
                                                <DocObj>
                                                        <esql:get-string column="DocObject"/>
                                                </DocObj>
                                                <DocTitle>
                                                        <esql:get-string column="DocTitle"/>
                                                </DocTitle>
                                                <DocVer>
                                                        <esql:get-string column="DocVersion"/>
                                                </DocVer>

<!--
Get Sections-->
                                                <Section>
                                                        <esql:execute-query>
                                                                <
esql:query>select * from section where SecID=<xsp:expr>section</xsp:expr></esql:query>
                                                                        <esql:results>
                                                                                <esql:row-results>
                                                                                                <SecTitle>
                                                                                                        <esql:get-string column="SecTitle"/>
                                                                                                </SecTitle>
                                                                                                <SecContent>
                                                                                                        <esql:get-string column="SecContent"/>
                                                                                                </SecContent>
<!--
Get Chapter for every selected Section -->
                                                                                                <Chapter>
                                                                                                        <esql:execute-query>
                                                                                                                        <esql:query>select * from chapter where ChapID=<xsp:expr>chapter</xsp:expr> AND Section=<xsp:expr>section</xsp:expr></esql:query>
                                                                                                                                <esql:results>
                                                                                                                                        <esql:row-results>
                                                                                                                                                        <ChapTitle>
                                                                                                                                                                <esql:get-string column="ChapTitle"/>
                                                                                                                                                        </ChapTitle>
                                                                                                                                                        <ChapContent>
                                                                                                                                                                <esql:get-string column="ChapContent"/>
                                                                                                                                                        </ChapContent>
                                                                                                                                        </esql:row-results>
                                                                                                                                </esql:results>
                                                                                                                        </esql:execute-query>
                                                                                                        </Chapter>

                                                                                </esql:row-results>
                                                                        </esql:results>
                                                        </esql:execute-query>
                                                </Section>
                
                                        
</esql:row-results>
                                </esql:results>
                        </esql:execute-query>
                </esql:connection>
        </Document>
</
xsp:page>

myfile.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <xsl:template match="/">
                <html>
                        <head/>
                        <body>
                                <xsl:for-each select="Document">
                                        <br/>Titolo: <xsl:for-each select="DocTitle">
                                                <xsl:apply-templates/>
                                        </xsl:for-each>
                                        <br/>Oggetto: <xsl:for-each select="DocObj">
                                                <xsl:apply-templates/>
                                        </xsl:for-each>
                                        <br/>Versione:<xsl:for-each select="DocVer">
                                                <xsl:apply-templates/>
                                        </xsl:for-each>
                                        <br/>
<!-- Output Section -->
                        
<br/>&#160;<xsl:for-each select="Section">
                                                <br/>Sezione:<br/>Titolo: <xsl:for-each select="SecTitle">
                                                        <xsl:apply-templates/>
                                                </xsl:for-each>
                                                <br/>Commento: <xsl:for-each select="SecContent">
                                                        <xsl:apply-templates/>
                                                </xsl:for-each>
                                                <br/>
                                                <br/>
<!-- Output Chapter -->
                                                
<xsl:for-each select="Chapter">
                                                        <br/>Capitolo:<br/>Titolo: <xsl:for-each select="ChapTitle">
                                                                <xsl:apply-templates/>
                                                        </xsl:for-each>
                                                        <br/>Commento:<xsl:for-each select="ChapContent">
                                                                <xsl:apply-templates/>
                                                        </xsl:for-each>
                                                        <br/>
                                                        <br/>
                                                </xsl:for-each>
                                                <br/>
                                        </xsl:for-each>
                                        <br/>
                                        <br/>
                                </xsl:for-each>
                        </body>
                </html>
        </xsl:template>
</
xsl:stylesheet>



Reply via email to