Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / October 2004

Tip: Looking for answers? Try searching our database.

XslTransform converting &

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Hatcher - 08 Oct 2004 00:22 GMT
Hi

I have a transform going from XML to HTML, but I can't seem to get the
XslTransform class to output & as & even when using
disable-output-escaping.

I've tried writing the result to a Stream, but it still always converts the
values - it works fine if I use the MSXML library. Has anyone an idea how I
can get it to obey.

TIA

Paul
Oleg Tkachenko [MVP] - 08 Oct 2004 09:39 GMT
> I have a transform going from XML to HTML, but I can't seem to get the
> XslTransform class to output & as & even when using
> disable-output-escaping.

That's because
1) & should be escaped as & in HTML
(http://www.w3.org/TR/REC-html40/charset.html#h-5.3.2).
2) most likely you are using XslTransform in a way when
disable-output-escaping is ignored (e.g. transforming to XmlWriter or
even when creating attribute value).

Provided 1) I'd leave it alone.
Signature

Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Paul Hatcher - 08 Oct 2004 09:58 GMT
Oleg

I'm actually trying to output   into my HTML stream, but I can't use it
in the stylesheet as this raises an error so I use

<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

I found out about the restrictions on using XmlWriter the hard way, and I'm
currently using a FileStream - but it I still get &amp;nbsp; in the HTML

The XLST spec http://www.w3.org/TR/xslt#disable-output-escaping, seems to
say this is possible, but then the notes on XslTransform seem to imply that
the implementation is non-conformant.

Paul

> > I have a transform going from XML to HTML, but I can't seem to get the
> > XslTransform class to output &amp; as & even when using
[quoted text clipped - 8 lines]
>
> Provided 1) I'd leave it alone.
Oleg Tkachenko [MVP] - 08 Oct 2004 11:08 GMT
> I'm actually trying to output &nbsp; into my HTML stream, but I can't use it
> in the stylesheet as this raises an error so I use

You can just use &#xA0; as a numeric reference to the nonbreakable
space. There is no need for any trickery here.

> <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
>
> I found out about the restrictions on using XmlWriter the hard way, and I'm
> currently using a FileStream - but it I still get &amp;nbsp; in the HTML

Sorry, I can't reproduce the problem, it works (and always worked) for
me. Show some repro - XML, XSLT, code where you run XslTransform.

Signature

Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.