当前位置: 首页 > 网络学院 > XML相关教程 > XSL/XSLT > XSLT <xsl:text> 元素

XSL/XSLT
XSL 语言
XSLT 介绍
XSLT 浏览器
XSLT 转换
<xsl:template>
<xsl:value-of>
<xsl:for-each>
<xsl:sort>
<xsl:if>
<xsl:choose>
<xsl:apply-templates>
XSLT - 客户端
XSLT - 服务器端
XSLT - 编辑XML
XSLT 摘要
XSLT 元素参考
XSLT 函数
XSL 编辑器

XSL/XSLT 中的 XSLT <xsl:text> 元素


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 210 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The <xsl:text> element is used to write literal text to the output.
<xsl:text> 元素的作用是:将一段文本写入输出文档中。

Tip: This element may contain literal text, entity references, and #PCDATA.
提示:这个元素可以包含纯文本、实体参数和 #PCDATA。


Syntax
语法

<xsl:text
disable-output-escaping="yes|no">
 <!-- Content:#PCDATA -->
</xsl:text>

Attributes
属性

属性 描述
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 "&lt;". Default is "no".

可选参数。如果设置为"yes",则指定了具体字符(如:“<”)以其本身形式输出;如果设置为"no",则指定了具体字符(如:“<”)必须作为"&lt;"输出。默认为no

This attribute is not supported by Netscape 6
Netscape 6不支持该属性

Example 1
案例1

Displays the title of each CD. Inserts a ", " between each cd-title if it is not the last CD - or the last but one. If it is the last CD, it will add a "!" behind the title. If it is the last but one, add a ", and " behind the title:
下面的例子用于显示每张CD的title[标题]。如果指针并为处于最后一个CD标题指针处或仅包含一个CD标题,那么将在每个CD标题之间插入一个逗点(,);如果指针位于最后一个CD指针处,那么则必须在标题后面添加一个“!”。如果仅包含一个CD标题,那么则在标题后面加上一个", and ":

<?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()-1"> <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>

评论 (0) All

登陆 | 还没注册?