包括文件的标记物品 XML

我有一个文件 XML, 一个标签有很长的描述,所以我想在几个标记项目中格式化它

例如,


<description>This course is an introduction to the information technologies required for secure, practical information systems for electronic commerce.
Topics will be chosen from areas such as document representation /XML, DTDs, XML Schema, XSLT, CSS/, security /encryption, public key, symmetric key,
PKI, authentication/; kinds of attack and vulnerabilities, electronic trading /spontaneous, deliberative, auctions/, electronic document management
/metadata, search, digital libraries, management and processing/, recent developments and maturation of the area,
such as web application frameworks, web services, the semantic web , mobile commerce</description>


我希望它成为类似的东西

本课程是信息技术的介绍。
, 安全,实用信息系统所必需的
贸易。

线程将从此类区域中选择作为提交文件

/XML, DTDs, XML, XSLT, CSS/, 安全 /加密,打开键,
对称键 PKI, 验证/; 攻击类型I.

漏洞,电子交易 /自发,审议,

拍卖/,

电子文件管理 /元数据,搜索,电子图书馆,
管理与处理/, 最近的发展和发展
Web应用程序框架,Web服务,语义等领域
网络 , 移动商务

为此,我认为我必须在你的文件中改变一些东西 XSL, 哪一个


<xsl:template match="/">
<html>
<head>
<title> Course Catalogue </title>
</head>
<body bgcolor="#FF9999">
<xsl:for-each select="xsi:catalogue/xsi:course">
<br/>
<xsl:apply-templates select="xsi:title"></xsl:apply-templates>
<br/>
<xsl:apply-templates select="xsi:year"></xsl:apply-templates>
<br/>
<xsl:apply-templates select="xsi:science"></xsl:apply-templates>
<br/>
<xsl:apply-templates select="xsi:area"></xsl:apply-templates>
<br/>
<xsl:apply-templates select="xsi:subject"></xsl:apply-templates>
<br/>
<xsl:apply-templates select="xsi:unit"></xsl:apply-templates>
<br/>
<xsl:apply-templates select="xsi:description"></xsl:apply-templates>
<br/>
<xsl:apply-templates select="xsi:outcomes"></xsl:apply-templates>
<br/>
<xsl:apply-templates select="xsi:incompatibility"></xsl:apply-templates>
</xsl:for-each>
</body>
</html>
</xsl:template>


而对于 xsi:description,


 The template for course description 
<xsl:template match="xsi:description">
<div style="font-family:times;font-size:16">
<span style="color:#000">
Course Description:
</span>
<xsl:value-of select="."></xsl:value-of>
</div>
</xsl:template>


我该如何包含标记物品? 谢!
已邀请:

窦买办

赞同来自:

您必须选择分隔符将您的描述划分为标记。 以下是使用点和点作为分隔符使用点和点的分隔示例:

模板:


<xsl:template match="xsi:description">
<div style="font-family:times;font-size:16">
<span style="color:#000">Course Description:</span>
<ul>
<xsl:analyze-string flags="sm" regex=".*?[\.;]" select="string//">
<xsl:matching-substring>
<li><xsl:value-of select="."></xsl:value-of></li>
</xsl:matching-substring>
<xsl:non-matching-substring>
<li><xsl:value-of select="."></xsl:value-of></li>
</xsl:non-matching-substring>
</xsl:analyze-string>
</ul>
</div>
</xsl:template>


出口:


<div style="font-family:times;font-size:16">
<span style="color:#000">Course Description:</span>
<ul>
<li>This course is an introduction to the information technologies required for secure, practical information systems for electronic commerce.</li>
<li>Topics will be chosen from areas such as document representation /XML, DTDs, XML Schema, XSLT, CSS/, security /encryption, public key, symmetric key, PKI, authentication/;</li>
<li> kinds of attack and vulnerabilities, electronic trading /spontaneous, deliberative, auctions/, electronic document management /metadata, search, digital libraries, management and processing/, recent developments and maturation of the area, such as web application frameworks, web services, the semantic web , mobile commerce</li>
</ul>
</div>


您可以更改值 regex 从
.*?[\.;]

在别的东西上,如果您想使用其他规则来拆分段落。

要回复问题请先登录注册