Subject: Re: [xsl] Character entities in attribute values From: Mike Brown <mike@xxxxxxxx> Date: Wed, 23 Apr 2003 07:05:27 -0600 (MDT) |
mark_fletcher@xxxxxxxxxxxxxx wrote: > the output text looks something like this: &eacute; instead of this: > é First please realize that when you output XML or HTML, the XSLT processor is (effectively, not necessarily) running a node tree through a serializer, and the serializer is what is escaping "&" and "<" and certain other characters appearing in places where they would otherwise be confused with markup. If you're getting &eacute; in the output, then you must have put the 8 characters "&" "e" "a" "c" "u" "t" "e" ";" into an attribute node (or text node, but you mentioned attribute) in your result tree, perhaps by copying this text from the source tree. Since you told the processor you wanted the *node* to contain those 8 characters, rather than 1 entity reference, it serialized the node in such a way that you'd get the characters when the output document is parsed. In other words, it preserved the semantics of the data, clearly distinguishing between character data and the structures implied by markup. Given that the XML parser feeding parsed data to the XSLT processor would have interpreted "é" in your original source document as a reference to the entity named acute, there's no way the 8 characters could have ended up in your source tree unless you did one of the following: - explicitly constructed that string in your stylesheet - copied text that was originally written like &eacute; - copied text that was originally written like <![CDATA[é]]> Both of the latter two mean exactly the same thing, and since the most common FAQ and misconception on this list (well, one of the most common) is the mistaken assumptions people make about what CDATA sections are, I'm going to guess that whoever made your XML decided to try to use it as a transport for entity-laden, non-well-formed HTML, saying that this data is just text, not markup. Then you tried to use XSLT to copy it through, and were surprised to see that you can't use XSLT to pretend character data is actually markup. However, as others have mentioned, this is just a wild guess. Explain more about what you're doing, with sample code (brief). XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Character entities in att, Mike Haarman | Thread | [xsl] That old song "document() wit, Alexander Johannesen |
Re: [xsl] controller stylsheet. per, Terence Kearns | Date | Re: [xsl] Tail recursion (WAS: Grou, Mike Brown |
Month |