样式单文件源代码 (主要是表格的构建:) ):<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
<?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" xml:space="preserve">
<xsl:output encoding="gb2312"/>
<xsl:template match="/履历列表/履历元素">
<html>
<head>
<title>
<xsl:value-of select="/姓名"/>个人简历</title>
<style>
table{cellpadding:0;cellspacing:0;border-collapse:collapse;}
td{border:1px solid black;font-size:12px;}
th{border:1px solid black;font-size:12px;}
p{font-size:12px;}
</style>
</head>
<body>
<p style="font-weight:800;font-size:24px;" align="center">
<xsl:value-of select="/姓名"/>
个人简历
</p>
<p align="center">
<table width="600px">
<tr>
<th width="15%">姓名</th>
<td width="15%">
<xsl:value-of select="/姓名/姓"/>
<xsl:value-of select="/姓名/名"/>
</td>
<th width="15%">性别</th>
<td width="15%">
<xsl:value-of select="/性别"/>
</td>
<td rowspan="3" width="15%">
<img alt="照片" width="100px" src="{/照片路径/@val}"/>
</td>
</tr>
博客给出了样式单文件源代码,主要用于表格构建。代码包含 XML 声明、XSL 样式表定义,在模板匹配中构建 HTML 页面,设置表格、单元格样式,还展示了如何从数据中提取姓名、性别等信息并显示在表格中。
86

被折叠的 条评论
为什么被折叠?



