用Xslt如何来实现单双行的区分
时间:2003-05-29
来源:互联网
我这样用
<xsl:template match="record">
<tr>
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<!-- 这里为显示行的颜色 -->
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="record" /></td>
</tr>
</xsl:template>
结果就说“未指定的错误。。。。。。。
我给<xsl:choose>去掉后是能正常解析的
有什么问题?
<xsl:template match="record">
<tr>
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<!-- 这里为显示行的颜色 -->
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="record" /></td>
</tr>
</xsl:template>
结果就说“未指定的错误。。。。。。。
我给<xsl:choose>去掉后是能正常解析的
有什么问题?
作者: debug 发布时间: 2003-05-29
不会啊
我自己的网站里面都是使用这个实现的
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:zfunc="urn:Snakevil.H.William:pro-func">
<xsl:include href="./context.xsl" />
<xsl:include href="./copyright.xsl" />
<xsl:include href="./func.xsl" />
<xsl:output encoding="gb2312" indent="yes" media-type="text/html" method="html" standalone="yes" />
<xsl:template match="/article">
<html>
<head>
<title>思绪的湖泊--静夜笔触--<xsl:value-of select="title/text()" /></title>
<meta name="Author" content="Snakevil.H.William"></meta>
<link rel="stylesheet" type="text/css" href="../_style/wq05a83_.css"></link>
<link rel="stylesheet" type="text/css" href="../_style/context.css"></link>
<link rel="stylesheet" type="text/css" href="../_style/copyright.css"></link>
<script language="jscript" src="../_script/base.js"></script>
<script language="jscript" src="../_script/context.js"></script>
<script language="jscript" src="../_script/wq05a83r.js"></script>
</head>
<body onclick="snContext()"
oncontextmenu="nwContext()"
ondragstart="noEffect()"
onhelp="cHelp()"
onkeydown="cShortC()"
onload="sniffer()"
onscroll="snContext()"
onselectstart="noEffect()">
<xsl:call-template name="selfContext" />
<xsl:apply-templates />
<xsl:call-template name="copyright" />
</body>
</html>
</xsl:template>
<xsl:template match="/article/title">
<p>沐风听雨——思绪的湖泊<label>>></label><a class="cTitle" href="../main.htm?wq05a83r/index.xml?x={zfunc:rndstr()}" target="_parent">静夜笔触</a><label>>></label><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="/article/author">
<blockquote>作者:<span><xsl:value-of select="text()" /></span></blockquote>
</xsl:template>
<xsl:template match="/article/content/graph[1]">
<div class="g0"><xsl:value-of select="text()" /></div>
</xsl:template>
<xsl:template match="/article/content/graph[position()!=1]">
<div class="g{1 + position() mod 2}"><xsl:value-of select="text()" /></div>
</xsl:template>
</xsl:stylesheet>
我自己的网站里面都是使用这个实现的
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:zfunc="urn:Snakevil.H.William:pro-func">
<xsl:include href="./context.xsl" />
<xsl:include href="./copyright.xsl" />
<xsl:include href="./func.xsl" />
<xsl:output encoding="gb2312" indent="yes" media-type="text/html" method="html" standalone="yes" />
<xsl:template match="/article">
<html>
<head>
<title>思绪的湖泊--静夜笔触--<xsl:value-of select="title/text()" /></title>
<meta name="Author" content="Snakevil.H.William"></meta>
<link rel="stylesheet" type="text/css" href="../_style/wq05a83_.css"></link>
<link rel="stylesheet" type="text/css" href="../_style/context.css"></link>
<link rel="stylesheet" type="text/css" href="../_style/copyright.css"></link>
<script language="jscript" src="../_script/base.js"></script>
<script language="jscript" src="../_script/context.js"></script>
<script language="jscript" src="../_script/wq05a83r.js"></script>
</head>
<body onclick="snContext()"
oncontextmenu="nwContext()"
ondragstart="noEffect()"
onhelp="cHelp()"
onkeydown="cShortC()"
onload="sniffer()"
onscroll="snContext()"
onselectstart="noEffect()">
<xsl:call-template name="selfContext" />
<xsl:apply-templates />
<xsl:call-template name="copyright" />
</body>
</html>
</xsl:template>
<xsl:template match="/article/title">
<p>沐风听雨——思绪的湖泊<label>>></label><a class="cTitle" href="../main.htm?wq05a83r/index.xml?x={zfunc:rndstr()}" target="_parent">静夜笔触</a><label>>></label><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="/article/author">
<blockquote>作者:<span><xsl:value-of select="text()" /></span></blockquote>
</xsl:template>
<xsl:template match="/article/content/graph[1]">
<div class="g0"><xsl:value-of select="text()" /></div>
</xsl:template>
<xsl:template match="/article/content/graph[position()!=1]">
<div class="g{1 + position() mod 2}"><xsl:value-of select="text()" /></div>
</xsl:template>
</xsl:stylesheet>
作者: snakevil 发布时间: 2003-06-03
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28