You can do this in XSLT 2.0 by using character maps. Assign two special
characters (for example, #xAB and #x BB) to the role of "<%" and "%>" and
then define a character map to replace them on serialization.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Victor [mailto:xsl-list(_at_)vitoni(_dot_)de]
Sent: 30 April 2005 16:12
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] disable-output-escaping for attributes
Some weeks ago I began converting some HTML pages which
contain asp tags
to xml to have only the structure without any layout related overhead
(to easy conversion to new layouts via XSL).
Some of these asp tags are "text" or could be treated as text nodes.
These are the nodes I tested my xsl templates with.
However some of the HTML elements use the result of asp calls
as values
for attributes.
After many, many pages of really bad HTML have been manually
converted I
noticed to my horror that these attributes were actually
escaped where I
didn't want them to.
After reading a lot of other post I am lost. It seems that no one has
thought about someone needing unescaped text as an attribute
value and
therefore "disable-output-escaping" does not work for attibutes.
Does a tool exist which supports a non-compliant mode to get
the things
done? Or is there a workaround?
Thanks,
Victor
old HTML:
<select name="myValue">
<option valu="0" selected="<% is_sel("myValue","0","selected")%>"
>0</option>
<option valu="1" selected="<% is_sel("myValue","1","selected")%>"
>1</option>
</select>
XML:
<select name="myValue">
<option valu="0">
<attribute name="selected"><![CDATA[<%
is_sel("myValue","0","selected")%>]]></attribute>
<text>0</text>
</option>
<option valu="1">
<attribute name="selected"><![CDATA[<%
is_sel("myValue","1","selected")%>]]></attribute>
<text>1</text>
</option>
</select>
XSL:
<xsl:template match="attribute">
<xsl:attribute name="{(_at_)name}"><xsl:value-of select="."
disable-output-escaping="yes"/></xsl:attribute>
</xsl:template>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--