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: Saxon and MSXML3 differences


Lee,

>I've encountered unexpected output with both
>Instant Saxon and MSXML3.  Do you think it is
>the ™ entity, defined in my DTD?

I don't know what version of Saxon you're using (it seems to work fine in
5.5.1), nor what you're viewing your output in (viewing output that
includes funny entities is always a little problematic because you need to
have a viewer that interprets the output encoding accurately).

BUT the problem may reside in your use of <xsl:value-of select="text()" />
rather than <xsl:value-of select="." />.  If you replace "text()" with ".",
and try it with MSXML3 (September), then you get what you expect.  This is
probably because MSXML3 makes an internal DOM that looks something like:

+- element SPA
   +- element PRODUCT
      +- text ALDARA
      +- text &#8482;
      +- text  5% CREAM

In other words, the text content of the PRODUCT element is split into three
because of the use of the entity.  When you do <xsl:value-of
select="text()" /> it gives the string value of the first text() node: in
this case just "ALDARA".

I think that MSXML is wrong to do this, at least with regards to the
interpretation of XPaths if not in the construction of the internal DOM.
The XPath spec says:

"Character data is grouped into text nodes. As much character data as
possible is grouped into each text node: a text node never has an
immediately following or preceding sibling that is a text node."
[http://www.w3.org/TR/xpath#section-Text-Nodes]

There aren't such things as 'entity reference nodes' within the XPath Rec
(even though there are entity reference objects under the DOM Level 1
Specification).

Anyway, Lee, you're probably much better off using <xsl:value-of select="."
/> in most cases anyway, because it will ignore any element content in
constructing the string value, which is generally a good thing.

Hope that helps,

Jeni

Jeni Tennison
http://www.jenitennison.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]