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

Re: When is xsl:text relevant?

Subject: Re: When is xsl:text relevant?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 8 Jun 2005 13:38:54 +0100
xsl text p
  Would it make more sense to use :
  <p><xsl:text>Total Amount: </xsl:text></p>

  Instead of :
  <p>Total Amount: </p>


These two are completely equivalent. There are two reasons for using
xsl:text

The first one is that people like to indent their stylesheets
and if you go

  <p>
   <xsl:text>Total Amount: </xsl:text>
  </p>

  <p>
   Total Amount: 
  </p>

then the first one is still equivalent to the two above, but the second
one has changed the content of the p element adding 2 newlines and some
space characters. (Which in this case doesn't change the html rendering,
but in general, it might)

The other reason is that white space text nodes in a styelesheet are
typically ignored, which is why


  <p>
   <xsl:text>Total Amount: </xsl:text>
  </p>


is the same as

  <p><xsl:text>Total Amount: </xsl:text></p>


so if you want to add some space then you can use xsl:text as a white
space text node of xsl:text is not ignored.

  <p> </p>                     will produce <p/>
  <p><xsl:text> </xsl:text></p> will produce <p> </p>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

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.