This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: symbols < and > in attribute


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]