Subject: Re: [xsl] Passing through character entities intact From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx> Date: Thu, 11 Oct 2001 10:53:40 -0400 |
[McCollum , Angus] > Thanks to everyone for their posts on this topic. I now understand why > entity references such as — are removed before XSLT processing. > > Unfortunately it seems like a common need to pass defined references through > from the input document type to the output document type exists. If the XSLT > transformation included an entity reference this can be passed through to > the output document. > > Why then doesn't XSLT processors or the output XML serializer take a look at > output document type and any included general entity declarations could > matched to the output stream to replace with a reference. > > I noted that references such as & are passed through. Apparently they > are not simply passed through but parsed as a '&' character and then > substitued with a reference when the final document is written. If this > works for XML's five entity references why can the serializer check for > document specific references? > Because the serializer never sees any document specific references. The XML spec requires the parser to replace each character reference with the proper encoded value - that is, in the encoding it uses internally, normally that would be either utf-8 or utf-16. After that, there are no more character references. It's no different than using a char(160) function in a programming language. Now you could write your own serializer that would output your desired character references when it encountered your magic characters. Maybe someone could help you with modifying an existing one. Mike can correct me, but it shouldn't be too hard. Or you could post-process the output with perl, python, awk, or whatever. Or you could see whether perhaps you don't need to do anything. The xml output will already have whatever character references are needed, even if they don't look like what you expected to see. So further processing should work (although human editing might be harder). Cheers, Tom P XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Passing through character, McCollum , Angus | Thread | Re: [xsl] Passing through character, David Carlisle |
[xsl] xpathapi question, Sanjay Pandey/Towers | Date | Re: [xsl] Passing through character, David Carlisle |
Month |