Re: JavaScript and  

Subject: Re: JavaScript and  
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 11 Aug 2000 10:38:34 -0600 (MDT)
Shelly Nippard wrote:
> 1) i'm using eXcelon stylus to write xsl and the processor does not
> recognize either of the following for a non-breaking space: a) &amp;nbsp; OR
> b) &nbsp;

This is a FAQ that is in the FAQ. I don't mind typing it again, though.

&nbsp; is in both HTML and XML an entity reference. In HTML this entity is
by definition a representation of the numeric character reference
"&#160;". This is information is in the HTML specs. HTML and XML use the
same document character set (ISO/IEC 10646-1; 'Unicode', more or less), so
character number 160 is the same in both worlds.

The only entities predefined in XML are &amp; &lt; &gt; &quot; &apos; for
& < > " ', respectively. XSL is XML. So if you want a non-breaking space
character in your XSL document, you have several XML mechanisms for
representing it.

Without defining a new entity, your options are to use the numeric
character reference &#160; or &#xA0; or you can type or copy/paste the
literal character from somewhere (I typically use Character Map or Bjondi
Character Agent in Win95/98/NT/2000, or on WinNT, you can hold down Alt
and type 0160 on the keypad). You also have these options in HTML.

If you want to define an entity, add an entity declaration to the internal
DTD subset of the document that contains the &nbsp;, like this:

<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>

or import a file full of such declarations:

<!DOCTYPE xsl:stylesheet SYSTEM "xml-ISOents.txt">

You can get such a file at
http://www.oasis-open.org/cover/xml-ISOents.txt

Once you have put the character into the XSL document, it will go into the
stylesheet tree and result tree as the character you wanted, not as an
entity reference or numeric character reference. It will get changed back
into a reference upon output, depending on what output method you specify
and your XSLT processor's behavioral conventions.

> 2) how do you incorporate a JavaScript tag in xsl?

Also a FAQ.

http://www.dpawson.co.uk/
I'm having trouble accessing it right now, though.

See part C.4 of the XHTML 1.0 Recommendation at
http://www.w3.org/TR/xhtml1/

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


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


Current Thread