Gavin Tong wrote:
> ... we are using this example to create nbsp in
> the html output:
> <xsl:entity-ref name="#">160</entity-ref> which then produces our #160 and
> we get the nonbreaking space. Is there an easier way to do this? or a way
> to reference it again so we don't have to type it again and again.
1. You can put an entity declaration in the stylesheet's own internal
DTD subset, like:
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
Then wherever you need a non-breaking space in the result tree, just use
the entity reference.
2. Assign the value of the nonbreaking space to a global (top-level)
<xsl:variable name="nbsp"> </xsl:variable>
To use this in the stylesheet, then, just include the variable reference
$nbsp wherever you need it.
I don't know if either of them is "easier" -- depends on what you like!
(Btw, what XSLT processor are you using that accepts an xsl:entity-ref
John E. Simpson | "For a while I didn't have a car... I
http://www.flixml.org | had a helicopter... no place to park it,
XML Q&A: www.xml.com | so I just tied it to a lamp post and
| left it running. <slow glance upward>"
| (Steven Wright)