Possible problem generating javascript entities with XSL

All,

First, let me state up front that I am an HI designer, not an engineer,
so I just may have missed something here. I've posted this observation
on several lists, and the answer I got back doesn't work. I've also read
the latest draft, but can't seem to find a way to do this ion XSL, and I
think it will be common for those of us doing content.

A simplified set of sample files are included. I haven't tried this yet
in lotus alphaworks xsl or XT because I want to avoid the java route
right now; I am using ixslt from infoteria.

Thanks
--jp

Goal: To generate a javascript entity in my output because yes, some
attributes needs to be computed in the runtime context.

Basic problem: I want to generate a real "&" in my output, not an html
entity, e.g.:

<body background="&{foo}" ... >

Someone on the XSL list told me to do it like this in xsl:

<body bacgkround="&amp;{{foo}}" ... />

But that yields:


<body background="&amp;{foo}" ... >

in the output.

Since the "&" is a general char for doing entities, this works if the
&amp; is in the main text of the HTML. But (my SWAG): in the special
case of a tag attribute, the HTML entity gets parsed first and so the
parser never sees it as a javascript entity (it's as if it would have to
do two passes in that case)..

But if I change the xsl to

<body bacgkround="&{{foo}}" ... />

I get this --no attribute at all -- and I don't know why:

<body bacgkround ... />

Can you explain what is happening here? Is there a way to get the pure
"&" character in the output stream? In general, doesn't XSL provide an
escape "take the following characters exactly as is" mode? If it does,
iI found it extremely non-obvious.

Sample files: Generate simple.html anyway you want from simple.xml +
simple.xsl; the correct result is simpleCorrect.html (note that IE5
doesn't seem to parse legal JS entities at all; works fine in Netscape).

Received on Thursday, 1 July 1999 03:37:21 UTC