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: How do you get the non-transformed character entity out of MSXML3.0


Hi Nate,

At 10:27 AM 9/19/01, you wrote:
>As an aside, what is the reasoning behind attributes not having a single
>text node child?

Since their value is accessible as, well, their value, they don't need a 
text node child. Calling it a text node would obfuscate the difference 
between nodes (that are structurally part of the tree) and attribute 
values. In the data model, every node has a string value, which is very 
consistent.

>As stated in section 5.7 of the XPath 1.0 spec, "Characters inside comments,
>processing instructions and attribute values do not produce text nodes."
>
>It seems to me that XPath is lacking in this case.  Of those three, comments
>are the only ones that end up only having text within them.  Attributes have
>an expanded name and text, and processing instructions have a 'string value'
>as defined by the spec, but also have what appear to be attributes (though
>they aren't defined as such).

Not so. None of them have text "within them": they all have text values. 
Attributes also have (expanded) names; PIs, additionally, have "targets", a 
notion inherited from the semantics of processing instructions in SGML (and 
still a useful feature). But PIs do *not* have attributes: the use of 
"pseudo-attributes" in PIs is just a conventional way of representing 
name-value pairs inside a PI, a very useful thing to do. But you could put 
any string at all in a PI; some systems might parse these strings according 
to their own expectations, and make use of them. What happens inside a PI 
is completely up to the designer of the PI and its target application.

>I'm sure this wasn't just done randomly, but I fail to see the logic in
>this.  Why is XPath limited by its data model, etc. to not be able to select
>just the text portion of these nodes?  Can someone please clue me in?

If by "these nodes" you mean comments, attributes, and PIs, it doesn't need 
to do this since you can get any node's value. If by "these nodes" you mean 
pseudo-attributes in PIs, the data model doesn't actually want to do this, 
since to achieve this you would have to constrain the use of PIs to no good 
purpose (and implicitly extend the specification for XML, which allows any 
string inside a PI as long as it doesn't contain '?>').

If you're interested in reading specs, the one to review is the XML spec, 
which says nothing about pseudo-attributes in PIs (because they're not 
formally part of XML).

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


 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]