Re: [xml] Possible bug : inconsistency between xsl:copy-of, namespaces and xsd validation



On Wed, Sep 15, 2004 at 09:50:33AM -0400, Agustín Villena wrote:
Hi!
    I'm developing a series of xsl function extensions which implements
xmldsig signatures. My client need that any transformed document pass
through a schema validation. I'm using the new XSD schema validation from
libxml 2.6.13, and libxslt 1.1.10

The next XML is the result of the XSL transformation

<?xml version="1.0" encoding="ISO-8859-1"?>
<DTE xmlns="http://www.sii.cl/SiiDte";>
    <Documento ID="T33F100"/>
    <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"/>
</DTE>

The "Signature" element was created using xsl:copy-of

  xsl:copy-of what ? in what context ?

The problem is when I validate the resulting in-memory doc from the
transformation, the validation fails. I trace back the problem to

xmlschemas.cl, line 13200+

if (child->ns != NULL)
    nsUri = child->ns->href;

When "child" is the Signature element, the namespace obtained is
"http://www.sii.cl/SiiDte";, instead of the expected
http://www.w3.org/2000/09/xmldsig#
[...]
I traced back the problem to libxslt's transform.c, at the implementation of
xslCopyOf, more exactly at xsltCopyTree / xmlNewNs part, which seems to not
copy the namespace declared in the Signature node to the xmlNode's ns field
(which is the examinated in the schema validation routine), but to node's
nsDef field

line 1039
xmlNewNs(copy, (*cur)->href, (*cur)->prefix);


Since my limited knowdlege of namespace handling iin libxml, I'm not really
sure if the problem is in xsl:copy-of or in the namespace checking part of
XSD validation. Therefor I attach a sample program that exemplifies the
inconsitency between "in memory" and "from disk" validation of the same
transformed doc.

Any help will be really appreciated

  Trying to debug a namespace XSLT generation without the stylesheet
producing it is a hopeless task. We need more info !

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]