Re: [xsl] Word Highlighting

Subject: Re: [xsl] Word Highlighting
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 5 Nov 2002 15:36:37 -0700 (MST)
Paul Terray wrote:
> >Which processor are you using? Entities will not generate separate text 
> >nodes in the data model, il.e. a text node never has an immediately 
> >following or preceding sibling that is a text node - see 
> ><http://www.w3.org/TR/xpath#section-Text-Nodes>.
> 
> MSXML 3.0 and 4.0 exhibit this behavior. Perhaps is it linked to my entity 
> definition :
> <!ENTITY eacute "&#38;#x00E9;">

Their XPath implementation is broken since it doesn't treat sibling text nodes
as if they were merged. IIRC, there's a normalize method you can call on the
document node to merge all the text nodes. Someone more familiar with MSXML
will have to comment. Note that a Google search for msxml merge text nodes
turned up
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmmthnormalize.asp
pretty quickly. For MSXML questions, always check the docs at MS first! :)

Your entity definition is not the cause of the problem, but it will cause
problems of its own. It just says that "&eacute;" in your document should be
replaced with the string "&#x00E9;" (8 characters). That may be what you want
in the serialized output, but entities only apply to input. To get something
close to what you want in the output, you should define eacute as being the
single character "&#xE9;" and then let the serializer part of the XSLT
processor take care of emitting the right reference automaticaly. <xsl:output
method="xml" encoding="us-ascii"/> will help in this regard; Unicode character
E9 can't be represented in ASCII, so it will be serialized as something like
"&#233;", most likely. And make sure you aren't capturing the output in a
16-bit String object, or it'll be UTF-16, regardless of what encoding you
asked for in xsl:output.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

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


Current Thread