W3C home > Mailing lists > Public > xsl-editors@w3.org > July to September 1999

Possible problem generating javascript entities with XSL

From: Jim Palmer <jpalmer@liberate.com>
Date: Thu, 01 Jul 1999 00:36:09 -0700
Message-ID: <377B1A69.6148B46B@liberate.com>
To: xsl-editors@w3.org

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.


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).

(image/gif attachment: arrows_l.gif)

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:17:45 UTC