Hi,


I have some weird problem that seems to be cocoon/trax related. Let's 
have two simple files:


bug/src.xml (should be allowed to be much more complicated):

<?xml version="1.0"?>
<root><addsql/><root>


bug/addsql.xsl:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="addsql">
   <execute-query xmlns="http://apache.org/cocoon/SQL/2.0";>
     <query name="file">SELECT 1 AS bug</query>
   </execute-query>
</xsl:template>
<xsl:template match="@*|node()|text()" priority="-1">
   <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
   </xsl:copy>
</xsl:template>
</xsl:stylesheet>


and fragment of sitemap.xmap

<map:match pattern="bug">
  <map:generate src="context://bug/src.xml"/>
  <map:transform src="context://bug/addsql.xsl"/>
  <map:transform type="sql">
   <map:parameter name="use-connection" value="whatever"/>
  </map:transform>
  <map:serialize/>
</map:match>


the output is ... nothing however in the logs I can found everything up to

HttpProcessor[8180][0]/SQLTransformer$Query: EXECUTING SELECT 1


one possible fix is to add implicit

<xsl:template match="root">
   <root>
     <xsl:apply-templates />
   </root>
</xsl:template>

but it is impossible for dynamic xml to hardcode all possible tags ;)

another problem is that while the result after fix looks quite well:
<root>
   <rowset name="file">
<row>
<bug>1</bug>
</row>
</rowset>

</root>

it is almost impossible to do anything advanced with it (eg add another 
xslt map:transform after sql one) since rowset has different namespace 
than root - even if this cannod be seen after serialisation.

Some debbuging - <map:transform src="context://bug/debug.xsl"/> at end
with debug.xsl:

<xsl:template match="/|*">
   <element name="{name(.)}"
    namespace="{namespace-uri(.)}"
    local="{local-name(.)}">
     <xsl:apply-templates/>
   </element>
</xsl:template>

shows that there seems to be a lot of problem - eg diffrent namespaces 
for diffrent elements and even empty element names whit nonempty 
local-names :/

<element local="" namespace="" name="">
<element local="root" namespace="" name="root">
<element local="rowset" namespace="http://apache.org/cocoon/SQL/2.0"; 
name="">
<element local="row" namespace="http://apache.org/cocoon/SQL/2.0"; name="">
<element local="1" namespace="http://apache.org/cocoon/SQL/2.0"; 
name="">1</element>
</element></element></element>


I was investigating this for an hours but without any resonable ideas 
and digging into even more weirdness like this.


Also please don't send messages like - 'don't use xsl:copy' or 'keep 
your xsl / transformations simple'. I have found few times people 
reporting similar problems but without any solutions. I've tried to use 
either older and latest cvs cocoon.


here are links propably related to this problems:

http://mailman.real-time.com/pipermail/cocoon-devel/2001-July/009126.html
http://mailman.real-time.com/pipermail/cocoon-devel/2001-June/009014.html
http://www.mail-archive.com/cocoon-users@xml.apache.org/msg07324.html
http://mailman.real-time.com/pipermail/cocoon-devel/2001-April/007123.html


regards,

Szymon


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

Reply via email to