This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: regarding newline
- From: Jarno dot Elovirta at nokia dot com
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 11 Jul 2002 13:37:14 +0300
- Subject: RE: [xsl] regarding newline
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
> <!DOCTYPE xsl:stylesheet SYSTEM
> "D:\xsl-exp\characterEntities\entityref.dtd">
> the following is the contents of this file
>
> <!ENTITY space " "> <!-- space -->
> <!ENTITY quots """> <!-- double quotes-->
> <!ENTITY newline "
"> <!--new line--> etc.....
[snip]
> I now want to use the newline character.
> so instead of using the <xsl:text>
</xsl:text>
> i declare the entity in the dtd..
>
> <!ENTITY newline "
"> <!--new line-->
>
> and try to do things like
> <xsl:value-of select = "@id"/> &newline;<xsl:value-of select = "."/>
> nothin seems to happen..
That's because when the XML parser replaces the entity reference, you get
<xsl:value-of select = "@id"/> 
<xsl:value-of select = "."/>
and when the XSLT processor first strips the white space from the stylesheet, this is turned into
<xsl:value-of select = "@id"/><xsl:value-of select = "."/>
It works with &space; because NO-BREAK SPACE is not considered white space.
> Any ideas regarding what i should do ??
You could use
<!ENTITY newline "<xsl:text>
</xsl:text>">
but make sure not to use it inside xsl:text, i.e.
<xsl:value-of select = "@id"/><xsl:text>&newline;</xsl:text><xsl:value-of select = "."/>
Santtu
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list