Konstantin,

we've experienced a similar problem, too.  We had input XML that used the
SQL transformer namespace, transformed with an XSLT stylesheet, and fed
into SQL transformer, with the same error.  We had a template that created
the SQL query tags for the transformer, and the namespace was declared only
in its output elements.  I theorized that there was some bug in the XSLT
transformer that was copying this namespace into other tags as well, which
definitely will cause an NPE (SQL transformer probably needs to do a better
job ignoring tags it doesn't know about).  However, I never could
conclusively prove that this was happening.

We did track the problem down, sort of, to the use of <xsl:copy> or
<xsl:copy-of>.  Essentially we had the usual default copy template to
handle the non-SQL transformer elements, like this:
<xsl:template match="@*|node()" priority="-1">
  <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

It appeared to me that the xsl:copy was adding in the SQL transformer
namespace URI to elements it was copying (even though that namespace was
declared in another template for a node that was sibling, never ancestor to
the non-SQL transformer nodes), because if we copied each element
explicitly (e.g: <xsl:template match
="apple"><apple><xsl:apply-templates/></apple></xsl:template>, etc.) the
problem went away.  I made a workaround by replacing this generic template
with two templates:
<xsl:template match="node()" priority="-1">
  <xsl:element name="local-name()">
     <xsl:apply-templates select="@*|node()"/>
  </xsl:element>
</xsl:template>

<xsl:template match="@*" priority="-1">
  <xsl:copy/>
</xsl:template>

This fixed our problem.  I started to write this up to send it to the list,
but it was just to weird to try to explain.  Also, I never could reproduce
it from scratch, only by using the code we had the problem on.  I still
can't explain it.

-Christopher



Paul,

I'm not sure that this is relevant for your case, but I was getting NPE
exactly at the same place when I had this template in my stylesheet:

  <xsl:template match="doc">
   <html xmlns="http://www.w3.org/1999/xhtml";>
  ...
      <xsl:apply-templates/>
   </html>
  </xsl:template>

Removing the 'xmlns' from <html> element solved the problem. This looks
like
a bug in Xalan.

Konstantin




---------------------------------------------------------------------
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:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to