This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: symbols < and > in attribute
- From: Mike Brown <mike at skew dot org>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 11 Dec 2001 10:17:40 -0700 (MST)
- Subject: Re: [xsl] symbols < and > in attribute
- Reply-to: xsl-list at lists dot mulberrytech dot com
Ernesto Reinaldo wrote:
> I'm generating JSP pages from an XML document and in
> these pages I need to have tags of the following form
>
> <mytag ttr1="<%= value%>"/>.
>
> [...]
>
> Somewhere I read (maybe in the
> specification) that is not possible to use
> dissable-out-escaping to generate attributes... So my
> my question is if there is a "clean" way to go around
> that? How can one get the charactes < and > printed in
> the attribute?
That's correct, there is no way to do this in XSLT when using the HTML
or XML output methods, not even by using disable-output-escaping, since
disable-output-escaping is only allowed to affect text nodes, if it is
supported at all.
You have 2 practical options:
1. Non-portable vendor extensions. Saxon, for example, has an extension
attribute for this purpose. See
http://saxon.sourceforge.net/saxon6.5/extensions.html
2. Instead of using the short <% %> syntax for JSP, use the longer,
more elegant XML syntax. See the JSP spec for this.
There is a third option that is not very practical, which is to use the
text output method and manually write out all your tags :)
- Mike
____________________________________________________________________________
mike j. brown, fourthought.com | xml/xslt: http://skew.org/xml/
denver/boulder, colorado, usa | personal: http://hyperreal.org/~mike/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list