RE: [xsl] character entities

Subject: RE: [xsl] character entities
From: "Edward Bryant" <bryant_edward@xxxxxxxxxxx>
Date: Thu, 28 Apr 2005 15:22:24 -0500
The &amp; represents an ampersand; it's seen within the XSLT stylesheet as a single character (for example, string-length() is 1); but if you serialize the result as XML or HTML then it will be >output as &amp; because that's how an ampersand is represented in XML and HTML.

I get that the "&amp;" is the unicode for an ampersand, but what do you mean by "serialize" ?


So, if a character reference is in an XML source file it will show up as a reference in an XHTML output file (I got the impression from other posts that the XSLT would change the reference into the actual character)?

You can't create character references in an XSLT template.

So what is the accepted way to add character references to the output? Would I have to run some kind of find-and-replace script after the XSLT transformation? What do other people do?


I came across "xmlchar" at XML.com. I didn't what to use it, but it changes an element into a character reference. Looking at their stylesheets, I don't understand how that works but my attempt to change <quote></quote> into the #8220 and #8221 entities won't?

That's not the output of the stylesheet (or even of the serializer): that's the output of the software that you're using to display the output of the serializer on your screen.

Sorry, I am an idiot, if I would have checked the XHTML output in notepad I would have noticed that.


Current Thread