Oleg Konovalov wrote:
Warrell,

So what you are saying is that I can not do SQL exception (or error) handling inside that SQL transformer
and have to do it from outside (and after the transformer itself).
Yes, that's what he says. The stylesheet preparing the SQL have no knowledge of the actuall call. How could it, since the call has yet to be made?
That is a pity, because in the same sql transformer file I have lots of column validations
which call it to show user errors, so it would be very convenient.

You can reuse templates in different stylesheets, so it should not be to much trouble to refactor.
OK, so here is my new transformer. Please tell me if it looks OK to you.
Have inserted it right after SQL Trasformer [before presentation screen.]
Still doesn't work.
<?xml version='1.0' encoding='UTF-8'?> <!-- Created to handle SQLExceptions during DB insert or update --> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
        xmlns:sql="http://apache.org/cocoon/SQL/2.0";>

<xsl:output method='xml' indent='yes'/>


<xsl:template match="/">
<page> <content>
            <xsl:apply-templates/>
This says: "Process all element-nodes below root"
        </content>
    </page>
</xsl:template>


<xsl:template match='mainTemplate'>
This says: "Match an element node named mainTemplate (<mainTemplate/>)". Do you have this element in your stream?
<xsl:if test="count(//sql:error[1]) > 0"> <!-- Do SQLExceptions check --> <error> <message>ERROR: Can not insert/update the record into the database (not recorded)</message> </error> </xsl:if>
</xsl:template>

</xsl:stylesheet>

Thank you,
Oleg.
Hope this helps.

Askild
-

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to