xsl:import 怎么import 两个xslt文件

jueban9818 2005-02-18 08:23:44
我想建立两个个共用模版:
如:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>·Jollo > 吃遍上海 > 餐厅排行榜</title>
<link href="../inc/food.css" rel="stylesheet" type="text/css"/>
</head>



Copyright © CSDN.net, Inc. All rights reserved

这两个模板

纯粹的文件,没有xml接点,可是如何放到页面的里呢?
...全文
140 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hatpdb 2005-03-11
  • 打赏
  • 举报
回复
header.xslt
<?xml version="1.0" encoding="GBK"?>
<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 name="head"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>·Jollo > 吃遍上海 > 餐厅排行榜</title>
<link href="../inc/food.css" rel="stylesheet" type="text/css"/>
</head>
</xsl:template>
</xsl:stylesheet>

footer.xslt
<?xml version="1.0" encoding="GBK"?>
<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 name="footer"/>
Copyright © CSDN.net, Inc. All rights reserved
</xsl:template>
</xsl:stylesheet>

useits.xslt
<?xml version="1.0" encoding="GBK"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:import href="header.xslt"/>
<xsl:import href="footer.xslt"/>

<!-- use its -->
<xsl:call-tempalte name="head"/>
<xsl:call-tempalte name="footer"/>
</xsl:stylesheet>
Gavin 2005-02-22
  • 打赏
  • 举报
回复
try:
做成两个<xsl:template name="head"/>,<xsl:template name="tail"/>, 然后 处理
<xsl:template match="/">
<xsl:call-tempalte name="head"/>

<xsl:apply-templates />

<xsl:call-template name="tail"/>
</xsl:template>

这个做成一个总接入点的xsl, 然后再别的xsl中import,注意别的xsl别match "/",,应该可以,
Good Luck~~~~
yuntailyg 2005-02-20
  • 打赏
  • 举报
回复
学习
jueban9818 2005-02-19
  • 打赏
  • 举报
回复
请给个代码代码看看啊
colee 2005-02-19
  • 打赏
  • 举报
回复
建两个xsl文件;可以连续使用两个xsl:import

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧