Ampersand in XSL

Ampersand in XSL

Post by Heath Stewar » Tue, 08 Jun 1999 04:00:00



Can anyone tell me why this isn't working in my stylesheet?

<TD><![CDATA[&nbsp;]]></TD>

I tranform the node on the server, but doubt that has anything to do with it
because I have used &nbsp; before in Response.Write() with ASP. Is there
possibly another way I can put amerpsands in my stylesheet?

BTW, just using

<TD>&nbsp;</TD>
 outputs HTML as
<TD>&amp;nbsp;</TD>

TIA
Heath Stewart

 
 
 

Ampersand in XSL

Post by David Fowle » Thu, 17 Jun 1999 04:00:00


The parser has knowledge of the CDATA parameter when the DOM is being
loaded.  Therefore the & is correct in the DOM.  However, when the
TransformNode() is performed the knowledge of CDATA has not been carried
forward.  The DOM then replaces "&" with "&amp;" for its own use.  It is
then returned from the TransformNode() with the &amp; still in place.

If anyone can solve this issue it would be greatly appreciated.

David Fowler

Bottomline Technologies (de), Inc.


> Can anyone tell me why this isn't working in my stylesheet?

> <TD><![CDATA[&nbsp;]]></TD>

> I tranform the node on the server, but doubt that has anything to do with
it
> because I have used &nbsp; before in Response.Write() with ASP. Is there
> possibly another way I can put amerpsands in my stylesheet?

> BTW, just using

> <TD>&nbsp;</TD>
>  outputs HTML as
> <TD>&amp;nbsp;</TD>

> TIA
> Heath Stewart



 
 
 

Ampersand in XSL

Post by John Andrew Morriso » Wed, 23 Jun 1999 04:00:00


     That is fine for the XML document, but what about in the
     XSL. Also, doesn't validate on parse defeat the purpose of
     XML in a shared document environment?

Thanks,
John Andrew Morrison


> The following works:

> <!DOCTYPE foo [
> <!ENTITY % HTMLENT SYSTEM "htmlent.dtd">
> %HTMLENT;
> ]>
> <foo>
>     &nbsp;
> </foo>

> But you will have to turn off validateOnParse before loading this document -
> since the rest of the DTD is missing.

>                   Name: htmlent.dtd
>    htmlent.dtd    Type: unspecified type (application/octet-stream)
>               Encoding: x-uuencode

 
 
 

Ampersand in XSL

Post by David Fowle » Sat, 14 Aug 1999 04:00:00


This information comes from someone much more knowledgable about XML/XSL
transforms then I.  And it works.

There is "a small quirk in the wonderful world of XSL transforms.  In a
nutshell although XSL transformations can produce adhoc output - there are
many areas where the XSL breaks down if it isn't producing XML.  This being
one of those areas.

So all they need to do is produce XML instead of text and then dig out the
node text."

After creating and loading the myDoc and myStyle DOMs use the following code
to transform and output the text:

' Transform using XSL
myDoc.transformNodeToObject myStyle, myRet

Print #1, myRet.documentElement.Text


> The parser has knowledge of the CDATA parameter when the DOM is being
> loaded.  Therefore the & is correct in the DOM.  However, when the
> TransformNode() is performed the knowledge of CDATA has not been carried
> forward.  The DOM then replaces "&" with "&amp;" for its own use.  It is
> then returned from the TransformNode() with the &amp; still in place.

> If anyone can solve this issue it would be greatly appreciated.

> David Fowler

> Bottomline Technologies (de), Inc.



> > Can anyone tell me why this isn't working in my stylesheet?

> > <TD><![CDATA[&nbsp;]]></TD>

> > I tranform the node on the server, but doubt that has anything to do
with
> it
> > because I have used &nbsp; before in Response.Write() with ASP. Is there
> > possibly another way I can put amerpsands in my stylesheet?

> > BTW, just using

> > <TD>&nbsp;</TD>
> >  outputs HTML as
> > <TD>&amp;nbsp;</TD>

> > TIA
> > Heath Stewart