中的.是什么意思?为什么不能就替换成为Name?谢谢!

luoxiang2000 luoxiang2000 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
是不是模板的名称必须和此模板中要处理的节点名称一致,如果是的话,那么如果我再一个模板中要处理多个节点怎么办?不懂!请指教!多谢!

我的xml文件:
<?xml version="1.0" encoding="GB2312"?>
<?xml:stylesheet type="text/xsl" href="resume.xsl"?>
<document>
<resume>
<name>王</name>
<sex>男</sex>
<birthday>1980.12</birthday>
<skill>VC、JAVA</skill>
</resume>
</document>

xsl文件:
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- 根模板 -->
<xsl:template match="/">
<html>
<head>
<title>个人简历</title>
</head>
<body>
<xsl:apply-templates select="document/resume"/>
</body>
</html>
</xsl:template>

<!-- 简历模板 -->
<xsl:template match="resume">
<table align="center" border="1">
<tbody>
<caption>个人简历</caption>
<tr>
<xsl:apply-templates select="name"></xsl:apply-templates>
</tr>
</tbody>
</table>
</xsl:template>

<!-- 姓名模板 -->
<xsl:template match="name">
<td>姓名</td>
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
</xsl:stylesheet>
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
luoxiang2000
XML/XSL 8,906 成员 22,677 内容