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]

Re: the nearest ancestor with the attribute


Hi Jeni,
--- Jeni Tennison <mail@jenitennison.com> wrote:
> I think I've got it straight in my head now...
> 
> > 1. Some nodes will have attributes that were not explicitly
> > expressed in the text of the xml document, but were
> > defined/defaulted in a DTD. What will be the "document order" for
> @*
> > in this case?
> 
> I expect that they'll be sorted in the same implementation-specific
> order as the rest of the attributes: probably alphabetically.
> 

No, at least with MSXML:

1. The explicitly specified attributes come first.

2. Then come the attributes from the DTD -- in the same order they were
declared in the DTD -- not in alphabetical order.

3. I found what seems a bug in MSXML -- see below. I will make a
"cleaner" experiment in order to be sure about this.

I made a quick test using the XPath Visualiser and IE.

The source xml document (docWithDTD.xml):
---------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE gifts [
<!ENTITY nbsp "&#160;">
<!ELEMENT gifts (ModelNumber+)>
<!ELEMENT ModelNumber (#PCDATA)>
<!ATTLIST ModelNumber
               group (gold | red)  "red"
               dep (gold | red)  "red"
               prod (gold | red)  "red"
               location  CDATA    #IMPLIED 
               ref  CDATA    #IMPLIED 
               id  ID    #IMPLIED  >
]>

<gifts>
  <ModelNumber dep = 'red' group="red" prod="red">P6205 *
1103</ModelNumber>
  <ModelNumber dep="gold" group="red" prod="gold">P6205</ModelNumber>
  <ModelNumber dep="gold" group="red" prod="gold">1103</ModelNumber>
  <ModelNumber prod="gold">P6205</ModelNumber>
  <ModelNumber>1103</ModelNumber>
</gifts>

IE displays:
-----------
-<gifts>
<ModelNumber dep="red" group="red" prod="red">P6205 *
1103</ModelNumber>
<ModelNumber dep="gold" group="red" prod="gold">P6205</ModelNumber>
<ModelNumber dep="gold" group="red" prod="gold">1103</ModelNumber>
<ModelNumber prod="gold" group="red" dep="red">P6205</ModelNumber>
<ModelNumber group="red" dep="red" prod="red">1103</ModelNumber>
</gifts>


The XPath Visualiser displays:
-----------------------------
-<gifts>
<ModelNumber dep="red" group="red" prod="red">P6205 *
1103</ModelNumber>
<ModelNumber dep="gold" group="red" prod="gold">P6205</ModelNumber>
<ModelNumber dep="gold" group="red" prod="gold">1103</ModelNumber>
<ModelNumber prod="gold" group="red" dep="red"
prod="red">P6205</ModelNumber>
<ModelNumber group="red" dep="red" prod="red">1103</ModelNumber>
</gifts>


Also there might be a bug in MSXML3 -- notice how there are two "prod"
attributes for the 4-th "ModelNumber".

Cheers,
Dimitre.

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.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]