快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

在模板中指定XSL样式表

模板文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:sql="urn:schemas-microsoft-com:xml-sql" sql:xsl="MyXsl.xsl">
<sql:query>
    Select FirstName,LastName from Employees For XML auto
</sql:query>
</root>


  在这里将模板文件tempxsl.xml存储在与template类型的虚拟名称(template)关联的目录中.XSL文件(MyXsl.xsl)也存储在同一目录中.MyXsl.xsl文件如下:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Employees">
<tr>
<td><xsl:value-of select="@FirstName"/></td>
<td><xsl:value-of select="@LastName"/></td>
</tr>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<style>th{background-color:#cccccc}</style>
</head>
<body>
<table border="2" style="width:300;">
<tr><th colspan="2">Employees</th></tr>
<tr><th>First Name</th><th>Last Name</th></tr>
<xsl:apply-templates select="root"/>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


执行模板:http://localhost/template/tempxsl.xml


返回类别: 教程
上一教程: XSL概述
下一教程: 利用XMLHTTP无刷新添加数据之Post篇

您可以阅读与"在模板中指定XSL样式表"相关的教程:
· CSS样式表简介
· XSL的模板规则
· W3C入门第4天:调用样式表
· XSLT的简朴使用[XML-->HTML]
· 在 XSL/XSLT 中实现随机排序
    微笑服务 优质保证 索取样品