Please visit our sponsors !
The <xsl:text> Element
Definition and Usage
The <xsl:text> element is used to write literal text to the output.
Tip: This element may contain literal text, entity references, and
#PCDATA.
Note: This element may have NON-standard behavior in IE 5.X!
Syntax
<xsl:text
disable-output-escaping="yes|no">
<!-- Content:#PCDATA -->
</xsl:text>
|
Attributes
Attribute |
Value |
Description |
disable-output-escaping |
yes
no |
Optional. "yes" indicates that special characters (like
"<") should be output as is. "no" indicates that special characters (like
"<") should be output as "<". Default is "no". This
attribute is not supported by Netscape 6 |
Example 1
Display the title of each cd. Insert ", " between each cd-title if it is
not the last cd or the last but one. If it is the last cd, add "!" behind the
title. If it is the last but one cd, add ", and " behind the title:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<p>Titles:
<xsl:for-each select="catalog/cd">
<xsl:value-of select="title"/>
<xsl:if test="position()!=last()">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="position()=last()-1">
<xsl:text>, and </xsl:text>
</xsl:if>
<xsl:if test="position()=last()">
<xsl:text>!</xsl:text>
</xsl:if>
</xsl:for-each>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
|
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|