xsl-list
[Top] [All Lists]

Re: When is xsl:text relevant?

2005-06-08 05:38:54


  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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--