Re: [xsl] html:br

Subject: Re: [xsl] html:br
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 31 Mar 2003 18:10:02 -0500
Karl,

You can certainly do

<!DOCTYPE xsl:stylesheet [
<!ENTITY lb "&#xA;">
]>

and then use

<xsl:text>&lb;</xsl:text>

Just don't expect it to work differently from putting a literal in there.

You can also do

<!DOCTYPE xsl:stylesheet [
<!ENTITY lb "<xsl:text>&#xA;</xsl:text>">
]>

but then

<xsl:text>&lb;</xsl:text>

would expand to

<xsl:text><xsl:text>&lb;</xsl:text></xsl:text>

which isn't allowed; in this case you'd use the entity outside any XSLT instructions, as in

<xsl:template match="element">
  <xsl:text>A line break:</xsl:text>
  &lb;
</xsl:template>

which would expand to

<xsl:template match="element">
  <xsl:text>A line break:</xsl:text>
  <xsl:text>&lb;</xsl:text>
</xsl:template>

Clearer yet?

This actually wouldn't be an XSL question at all except for the bit about whitespace-only nodes being stripped from the stylesheet outside the <xsl:text> instruction; to solve this puzzle you may have to get a grip on that issue separately from the issue of entity expansion. They're really separate issues, confused in this case by the fact that what you happen to want to represent in your entity, is whitespace (which is certainly okay to do, just not different from any other whitespace).

Cheers,
Wendell

At 05:12 PM 3/31/2003, you wrote:
Hmmm... good point.
So there is no way to create an "entity" (or similar) of a line break
character then?
Karl


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



Current Thread