[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: regarding newline

Subject: RE: regarding newline
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 11 Jul 2002 13:37:14 +0300
xml entity newline
Hi,

> <!DOCTYPE xsl:stylesheet SYSTEM 
> "D:\xsl-exp\characterEntities\entityref.dtd">
> the following is the contents of this file
> 
> <!ENTITY space "&#160;"> <!-- space -->
> <!ENTITY quots "&#34;"> <!-- double quotes-->
> <!ENTITY newline  "&#xa;"> <!--new line--> etc.....

[snip]

> I now want to use the newline character.
> so instead of using the <xsl:text>&#xa;</xsl:text>
> i declare the entity in the dtd..
> 
> <!ENTITY newline  "&#xa;"> <!--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"/> &#xa;<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>&#xa;</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


Current Thread
  • regarding newline
    • subbu - Thu, 11 Jul 2002 06:13:49 -0400 (EDT)
      • <Possible follow-ups>
      • Jarno . Elovirta - Thu, 11 Jul 2002 06:36:30 -0400 (EDT) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.