[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: fun with namespaces

Subject: Re: fun with namespaces
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 8 Mar 2000 23:25:32 GMT
Re: fun with namespaces

> 1
sorry can't answer that one (you asked me not to)

> if xt deems it necessary to have them to identify
> content in the output tree, it puts them there.
I did warn you:-)

> I'd be obliged if someone could tell me if 
> the XML source is 'correct' in its use of 
> namespaces.

You'll only moan about mathematicians again, but it's difficult to
prove it's correct if you don't say what it's supposed to do:-)

But I suspect not, as the namespace declarations don't agree with
the text. Also it's well formed but not valid, and if you only
cared aboy well formedness you din't need the dtd at all.


<!-- so top level belongs to namespace ns1 -->
<ns1:ns-test xmlns:ns1= "http://ns1.com">


  <block>
    <para>Para in block 1, main document namespace </para>
  </block>

`main document namespace' isn't a defined term. You haven't declared
a namespace for these so they (the block and para elements) are from
the null namespace.

  <ns2:block xmlns:ns2="http://ns2.com">
    <para>Para in block 2</para>
  </ns2:block>


ns2:block isn't in your dtd (which is why the document isn't valid)
but namespace people don't care for dtd's so that's OK.
ns2:block is in namespace 2, para is still in null namespace

ditto for next block, in namespace 3

<xsl:template match="block"><!-- Which namespace is this in then? -->
null namespace (even if you declare a default namespace, NCNames in
xpath expressions always refer to the null namespace)

since you are copying the xxx:block elements to the source then xt has
to copy the namespace declarations to maintain the integrity of the
result.

If however you _only_ copied the para elements (which are not themselves
in a namespace,  but have namespace declaration nodes inherited from
their xxx:block parents) then you would be able to control whether
the ns1 or ns2 namespaces were copied to the output.

David

(all untested, this time of night)


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.