This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to disable output escaping inside attribute values
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: Ivanco Maros <ivancoma at gratex dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 10 Apr 2002 10:52:20 +0100
- Subject: Re: [xsl] How to disable output escaping inside attribute values
- Organization: Jeni Tennison Consulting Ltd
- References: <D8D5BF650EABB649870ED3514E8F041261CB5A@dc01.hq.gratex.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Maros,
> is there any possibility to disable output escaping inside attribute
> values?
Not without creating the entire start tag (and end tag) by disabling
output escaping.
> I would love to output some hard spaces (and maybe some other escape
> characters) in dynamic output.
>
> Fragment of my generated XML is:
> <Location>
> <Company_name>My&nbsp;&nbsp;Company</Company_name>
> </Location>
You should fix your generated XML so that the non-breaking spaces are
specified through the non-breaking space character (#160) rather than
through the characters '&', 'n', 'b', 's', 'p', ';'. You could use
non-breaking space characters natively, or as character references:
<Location>
<Company_name>My  Company</Company_name>
</Location>
or you could use the entity in your generated XML, as long as
you declared it:
<!DOCTYPE Location [
<!ENTITY nbsp ' '>
]>
<Location>
<Company_name>My Company</Company_name>
</Location>
Whichever way you do it, the XSLT processor will see non-breaking
spaces. When you do:
<INPUT type="text" value="{/Location/Company_name}"/>
the XSLT processor will create a value attribute including the
non-breaking space characters. When it serializes this value attribute
as HTML, it will (probably) substitute the non-breaking space
characters with the HTML entity , and you'll get:
<INPUT type="text" value="My Company" />
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list