Subject: Re: Using Entity References in XSL Templates From: Theodore Epstein <Ted.Epstein@xxxxxxxx> Date: Fri, 21 Jan 2000 12:50:05 -0500 |
Mike and David, thanks for the replies. Part of my problem was that I was using the wrong XSL processor; your suggestions worked great with XT, but not with MSXML or the parser included with Object Design's Stylus. Another part of my problem was that a literal character #160 was mysteriously coming through not as a non-breaking space, but as a  character, which is ANSI #194. This happens even with XT, unless I set the output to HTML, in which case XT correctly maps   to So I assume it's something weird with ANSI vs. OEM character mapping on Windows NT. Following your advice, I defined nbsp as follows: <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "<xsl:text disable-output-escaping='yes'>&nbsp;</xsl:text>"> ]> This worked fine. In general, I do think there's an argument for allowing entity references to be passed through. I understand the inherent problem: the stylesheet is an xml document that has to be parsed before the xsl processor sees it, and entity references are resolved by the parser. But you might want xml output with entity references preserved, for example, if the output document is going to be edited, or piped through an additional processor that might assign new interpretations to the entities. The current solution of using <xsl:text> is decent, but I wonder if there are any plans to make this easier in a future version of XML and XSL. Regards, - Ted What you can do is ask that character 160 (whether input as character data, or   or ) is output as most likely the html output method will do this for you. If you are using the XML output method there is _no_ reason why you should want an entity refererence rather than the character, any XML system will treat them identically if nbsp is defined to be a reference to character 160. I don't see the value of outputting rather than  , but for entity references less trivial than this, I think this is a legitimate use of <xsl:text disable-output-escaping="yes">&nbsp;</text> Mike Kay David Carlisle wrote: > > But then the stylesheet processor resolves the entity reference, > > No, it never sees the reference, the XML parser it uses to read the > stylesheet will have expanded it before the XSL system gets the sheet. > That is what XML parsers are supposed to do. > > > I want the entity reference to be *passed through* > > to the output, which I can't seem to do. > > You can't. > > What you can do is ask that character 160 (whether input as > character data, or   or ) is output as > most likely the html output method will do this for you. > > If you are using the XML output method there is _no_ reason why you > should want an entity refererence rather than the character, any XML > system will treat them identically if nbsp is defined to be a reference > to character 160. > > David > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Using Entity References in XSL , David Carlisle | Thread | Re: Using Entity References in XSL , David Carlisle |
RE: JavaScript problem, Kay Michael | Date | Re: Absolute-path/index challenge, G. Ken Holman |
Month |