Re: [xsl] can you select name() of attributes?

Subject: Re: [xsl] can you select name() of attributes?
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Wed, 28 Jul 2004 06:28:37 +0000
Goodmorning (well, it is morning where I am),

This is in reply to David Carlisle's post, but anyone input is of course gladly received.

David Carlisle:
The old line is commented out. I found that the old one would copy every
attribute from $Doc1 if but one attribute of the same name exists in $Doc2.


I don't think it should, what processor?

I am using .NET 2003 and don't know which XSL processor it uses (other than being Microsoft). Is there some way of seeing this?



You have changed


[foo = bar] to [not(foo != bar)]

these two expressions are not in general equivalent (eg if either foo or
bar is a node set) but in your case both are the result of the name()
function so they are strings, and for strings these expressions are
equivalent.

You are absolutely right, I realise (after looking at the code again). Nevertheless, this is the behavior it exhibits, and I remembered reading about [not(A!=B)] being - in general - unequal to [A=B]. Changing this in the second 'copy-of' made it all right.


I have this morning tested my program, and the behaviour of your solution differs under the following conditions (still using .NET 2003):

Doc1.xml
<Input>
<I q="input value" s="Invalid attribute">Input</I>
</Input>

Doc2.xml
<A>
<B q="default" r="default">Text1</B>
</A>

When attribute 's' comes before 'q' in the input document (Doc1.xml), then it gives the expected output (with some permutations in the order of attributes):
<Output r="default" q="input value">Some text in the output element</Output>


When the attribute 's' comes after 'q' in the input (as shown above), it gives this result:
<Output r="default" s="Invalid attribute" q="input value">Some text in the output element</Output>.


I realise that this is not a conformant behavior, but it is the results that I get.

Regards,
Ragulf Pickaxe

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


Current Thread