xsl:stylesheet : scripts or PI embedded in attributes

Subject: xsl:stylesheet : scripts or PI embedded in attributes
From: Eric van der Vlist <vdv@xxxxxxxxxxxx>
Date: Fri, 03 Sep 1999 13:05:31 +0200
Hi,

I am using XT (Version 19990822) and I am struggling to embed scripts or
PI within attributes (my goal is to check the browser release and other
parameters such as cookies before calling javascript functions).

The script elements is working according to the W3C Working Draft 13
August 1999, except when you try to embed them in attributes (where they
are silently ignored and their content processed as normal text :

<script>if (a &lt; b) foo()</script>
<a href="foo.html">
	<xsl:attribute name="onClick">
		<script>if (a &lt; b) foo()</script>
	</xsl:attribute>
</a>

gives 

<script>if (a < b) foo()</script>
<a href="foo.html" onClick="if (a &lt; b) foo()"></a>

and so does 

<script><![CDATA[if (a < b) foo()]]></script>
<a href="foo.html">
	<xsl:attribute name="onClick">
		<script><![CDATA[if (a < b) foo()]]></script>
	</xsl:attribute>
</a>

PI instructions are just ignored while embedded in attributes :

<xsl:processing-instruction name="php">if (a &lt; b) foo();
?</xsl:processing-instruction>
<a href="foo.html">
	<xsl:attribute name="onClick">
		<xsl:processing-instruction name="php">if (a &lt; b) foo();
?</xsl:processing-instruction>
	</xsl:attribute>
</a>

gives 

<?php if (a < b) foo(); ?>
<a href="foo.html" onClick=""></a>                   

And, at last, text disable is forbidden within attributes :

<a href="foo.html">
	<xsl:attribute name="onClick">
		<xsl:text disable-output-escaping="yes">&lt;</xsl:text>
	</xsl:attribute>
</a>

gives the error 

illegal use of disable-output-escaping='yes'     

Is there any way(s) to embed scripts or PI instructions in attributes ?

Thanks

Eric

-- 
------------------------------------------------------------------------
Eric van der Vlist                                              Dyomedea

http://www.dyomedea.com                          http://www.ducotede.com
------------------------------------------------------------------------


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread