Meant to 'Reply All', which is automatic on the Ant lists. --DD

-----Original Message-----
From: Dominique Devienne 
Sent: Wednesday, November 20, 2002 4:17 PM
To: 'David Marston/Cambridge/IBM'
Subject: RE: Problem with xmlns:xsi declaration being propagated

Thanks for the answer David, but I still don't get it, and now I end up with
two xmlns declarations in my generated files. One for xsi, and one for my
newly added namespace!

After reading both parts of your article, I decided to see if following your
best practices would make my problem go away, but obviously I'm doing
something wrong, or not grasping something fundamental here...

Here's the top of my xml, xsd, and xsl files, after I've namespacified all
of them:

--- dependencies.xml ---
<dsp:module name="tahoe"
  xmlns:dsp="http://www.lgc.com/2002/Tahoe-dependencies-1.0";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://www.lgc.com/2002/Tahoe-dependencies-1.0
                      dependencies.xsd">

--- dependencies.xsd ---
<xs:schema attributeFormDefault="unqualified"
           elementFormDefault="qualified"
           targetNamespace="http://www.lgc.com/2002/Tahoe-dependencies-1.0";
  xmlns:xs="http://www.w3.org/2001/XMLSchema";
  xmlns:dsp="http://www.lgc.com/2002/Tahoe-dependencies-1.0";>

--- dependencies.xsl ---
<xsl:stylesheet version="1.0"
                exclude-result-prefixes="xsi dsp"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:dsp="http://www.lgc.com/2002/Tahoe-dependencies-1.0";>

I do understand your statement saying that exclude-result-prefixes applies
only in case the namespace is not needed, so in this case it kind of makes
sense to me why my new namespace (dsp) cannot be omitted, but how does the
xmlns:xsi declaration applies to sub-elements of the document?

Can you explain what's the relation between the <include> element (nested at
level 4), and the top-level namespace declaration xmlns:xsi? That element is
not part of that namespace, nor contains any attributes of that namespace,
nor contains any sub-elements of that namespace... I really don't get it.

You're renaming technique would for me to add new templates for all possible
child elements being copied, which doesn't seem very clean to me (assuming I
could get it right really).

Any help fixing, or even just understanding what's going on would be very
much appreciated. Thanks, --DD

-----Original Message-----
From: David Marston/Cambridge/IBM [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 20, 2002 11:38 AM
To: [EMAIL PROTECTED]
Cc: Dominique Devienne
Subject: Re: Problem with xmlns:xsi declaration being propagated

Dominique Devienne writes:
>...I transform a dependencies.xml file into several
>Ant build.xml files using a stylesheet...
>Adding xsi-related attributes ensured proper validation of the document
>...all elements of my source document which are copied as-is to
>the generated build.xml files now include an extraneous
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; declarations in
>them...
>How can I get rid of these xmlns:xsi declarations showing up every
>time I use <xsl:copy-of>???
>I tried using exclude-result-prefixes as shown below to no avail...

That's usually a sign that the namespace declaration was needed,
because exclude-result-prefixes only takes effect for namespace
declarations that were safe to omit, and it's really for use with
literal result elements (LREs). Part 2 of my developerWorks article
on namespaces at
http://www-106.ibm.com/developerworks/library/x-nmspace2.html
steps through the different ways to rename elements while "copying"
them from source to result, and may give you additional ideas.
.................David Marston

Reply via email to