This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Namespace incompatibility b/n XPath 2.0 Data Model and XPath 1.0 (Was Re: XML schema general convert with XSLT (namespaces..))


> > I have to know somehow in which namespace it is written, somehow. Is
> > there anyway of telling which namespace is used? Sure I can give the
> > used namespace as a paramter etc., but that really doesn't feel
> > right.
> 
> If I understand correctly, you have a QName in an type attribute's
> value (e.g. 'xs:string') and want to know the namespace URI that the
> prefix 'xs' is associated with. You can do that by looking at the
> namespace nodes on the attribute's parent element:
> 
>   ../namespace::*

This is not an objection to Jeni's solution, which is correct.

I was just thinking that when the XPath Data Model is implemented in XPath 2.0 the
above solution will have to be rewritten.

This is because according to the model namespace nodes will no longer be copied to
all descendent nodes. Another (minor) potential trap is that in XPath 2.0 a
namespace node has no parent.

There are two consequences of this decision:

1) ../namespace::* will no longer find all namespace nodes in whose scope is the
element, whose attribute is the current node.

2) more generally, this is an example, showing that the promise will not be
fulfilled that existing XSLT 1.0 transformations will work in XSLT 2.0 as in XSLT
1.0

I was also trying to guess how this solution will have to be modified, so that it
will also work in XPath 2.0. Maybe something like the following will do the job:

../ancestor-or-self::*/namespace::* 

It seems to me important to make people aware that because of such potential
compatibility problems in the future, we must start thinking now how best to avoid
them.

Cheers,
Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]