Re: [xsl] I need to make sure that all namespace declarations get output to a particular element, not the document element

Subject: Re: [xsl] I need to make sure that all namespace declarations get output to a particular element, not the document element
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 23 Mar 2007 12:28:26 +0100
bryan rasmussen wrote:
Actually I got another email where Lars Opermann, the fellow doing the
code inspection, says that he doesn't think that is what it's doing
after all, but if it were this would explain 90% of the problem I'm
having, although I would still be in the dark as to why when I have
<in:Invoice> with the in prefix declared further up in the document

With 'further up', do you mean _after_ it is actually used? And do you mean this as a result of the XSLT process? I thought you meant that you needed a more precise control over where you put your xml namespace declarations, but perhaps something else's up? Do you mean that your document looks like this XML doc, with incorrect namespace decl?


<root>
  <in:Invoice>
      <in:somenode xmlns:in="urn:invoice"/>
  </in:Invoice>
</root>


or like this (correct in terms of xml+ns)


<root>
  <in:Invoice xmlns:in="urn:invoice">
      <in:somenode />
  </in:Invoice>
</root>

I thought, from your OP, that the doc looked more something like this:

<root>
 <somenode xmlns:in="urn:invoice">
    <in:Invoice>
        <in:somenode />
    </in:Invoice>
 </somenode>
</root>

and that you rather want the namespace declaration on the in:Invoice element (middle example), and not before that.

I am just trying to clarify what it is that you actually need. In your OP there were a zillion namespaces and I hope that with a simple example it becomes more clear.

and I submit the xform via  a put to the filesystem what comes out is
<:Invoice> instead of just a message box with message "The in prefix
has not been declared."

The element that is serialized as '<:Invoice>' is not a legal XML+NS element (I believe it would be legal in old original XML, without namespaces, but that's not what XSLT creates).When you say 'put to the filesystem', do you mean the XSLT serializer, or your own post-processor? If any XSLT serializer creates a tag like that, it's an error.


-- Abel

Current Thread