社区
XML/XSL
帖子详情
关于index()的用法
顶尖程序员:)
2003-08-20 05:34:31
1.在xml中,用xsl解析一个动态数据(如果有8,9,42数据等),
如何实现背景色相同但是隔行显示,例如
就是说奇数行背景色是绿色,偶数行背景色是红色
2.问一下index()的用法,
...全文
85
2
打赏
收藏
关于index()的用法
1.在xml中,用xsl解析一个动态数据(如果有8,9,42数据等), 如何实现背景色相同但是隔行显示,例如 就是说奇数行背景色是绿色,偶数行背景色是红色 2.问一下index()的用法,
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
全息宇宙
2003-08-21
打赏
举报
回复
http://www.csdn.net/develop/read_article.asp?id=16034
http://www.csdn.net/develop/read_article.asp?id=16033
2.index()
含义:返回该元素在集合中的位置,返回值是一整数,其中第一个元素返回0
示例:返回前面三份简历
resume[index() $le$ 3]
注意:index()是与父元素相关的,请看下例:
< x >
< y/ >
< y/ >
< /x >
< x >
< y/ >
< y/ >
< /x >
返回所有< x >中的第一个< y >
x/y[index()=0] 或x/y[0]
KAI3000
2003-08-21
打赏
举报
回复
1,看下面这个例子,用了position()函数
XML File (cardgame.xml)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="cardgame_orig.xsl"?>
<cardgame>
<hand>
<player name="Jack">
<card dealtID="card01">
<rank>Q</rank><suit>Clubs</suit>
</card>
<card dealtID="card02">
<rank>A</rank><suit>Spades</suit>
</card>
<card dealtID="card03">
<rank>10</rank><suit>Hearts</suit>
</card>
<tell>twitches nervously</tell>
<card dealtID="card04">
<rank>8</rank><suit>Clubs</suit>
</card>
<card dealtID="card05">
<rank>4</rank><suit>Spades</suit>
</card>
<tell>squints</tell>
</player>
<player name="Jill">
<card dealtID="card06">
<rank>5</rank><suit>Diamonds</suit>
</card>
<card dealtID="card07">
<rank>5</rank><suit>Spades</suit>
</card>
<card dealtID="card08">
<rank>6</rank><suit>Clubs</suit>
</card>
<card dealtID="card09">
<rank>6</rank><suit>Spades</suit>
</card>
<card dealtID="card10">
<rank>10</rank><suit>Diamonds</suit>
</card>
<tell>grins</tell>
</player>
</hand>
<hand>
<player name="Jack">
<card dealtID="card11" replace="card03">
<rank>4</rank><suit>Diamonds</suit>
</card>
<tell>mutters, "Uh-oh..."</tell>
<card dealtID="card12" replace="card04">
<rank>K</rank><suit>Spades</suit>
</card>
<card dealtID="card13" replace="card05">
<rank>7</rank><suit>Spades</suit>
</card>
<tell>tugs at left ear</tell>
</player>
<player name="Jill">
<card dealtID="card14" replace="card10">
<rank>K</rank><suit>Diamonds</suit>
</card>
<tell>sips her drink</tell>
</player>
</hand>
</cardgame>
XSLT File (cardgame_orig.xsl)
The first version of the XSLT style sheet simply numbers the hands, using a template rule for the <hand> element:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/TR/REC-html40"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Set up the HTML page and table styles. -->
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>Card Game</TITLE>
<STYLE type="text/css">
h1 {background-color: gold;
font-family: Tahoma,Verdana,Arial,sans-serif;
font-size: 24pt}
h2 {background-color: yellow;
font-family: Tahoma,Verdana,Arial,sans-serif;
font-size: 18pt}
h3 {background-color: white;
font-family: Tahoma,Verdana,Arial,sans-serif;
font-size: 14pt;
font-weight: bold}
th {background-color: silver;
font-family: Tahoma,Verdana,Arial,sans-serif}
td {background-color: white;
font-family: Tahoma,Verdana,Arial,sans-serif}
.page {width: 75%}
.tell {font-weight: bold}
</STYLE>
</HEAD>
<BODY>
<DIV class="page">
<xsl:apply-templates/>
</DIV>
</BODY>
</HTML>
</xsl:template>
<!-- Suppress <tell> elements. -->
<xsl:template match="tell"/>
<xsl:template match="hand">
<h1>Hand #<xsl:value-of select="position()"/></h1>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
2,index()函数没有找到,有这个函数吗?
index
在c语言数组中的
用法
,引用函数
index
的
用法
1——数组
用法
index
函数返回区域中的值或值的引用。它包含两种
用法
:一种是数组
用法
,另一种是引用
用法
。今天先说数组
用法
。-01-函数说明可以看到它有2种写法,第一种就是数组写法,意思是返回区域或数组中的元素值,此值由区域中的行号和列号的数字给定。当
index
函数的第一参数为常量数组时,使用数组公式。array:必需。单元格区域或数组常量。如果数组只包含一行或一列,则相对应的参数row_num或column_n...
oracle中的
index
函数,
index
函数_excel中
index
函数的方法
Excel中经常需要使用到
index
函数,
index
函数具体该如何使用呢?下面是由学习啦小编分享的excel中
index
函数的方法,以供大家阅读和学习。excel中
index
函数的方法:
index
函数使用步骤1:下面用2个例子来说明数组形式和引用形式
用法
。
index
函数使用步骤2:首先介绍数组形式的使用方法
index
函数使用步骤3:举例1:在H2单元格中返回数组(D2:F11)中第3行、第3列的值...
js find
Index
方法
find
Index
用法
index
Of
用法
小结
一、
index
Of方法返回一个整数值,指出 string对象内子字符串的开始位置。如果没有找到该字符串则返回-1。 二、java中字符串中子字符串查找共有四种方法如下: 1、int
index
Of(string str) :返回第一次出现的指定子字符串在此字符串中的索引。 2、int
index
Of(string str, int start
Index
) : 从指定的索引处开始,返回第...
前端开发:JS中
index
Of() 方法的使用
前言 在前端开发过程中,对数组的数据进行处理也是比较常见的操作之一,而且对数组进行操作的频率远远大于对 对象进行操作,因此在开发过程中对于数组里面的数据进行处理是一项比较重要的技能,尤其是对于刚入行的前端开发者来说尤为重要,所以一定要掌握好相关技能。本篇博文来分享一下关于
index
Of() 方法的使用,它不仅可以在Array中使用,也可以String中使用,所以本文就直接把
index
Of() 方法的不同使用场景放一起来讲解,不在只局限于
index
Of() 方法在Array中使用。 一、
index
Of
XML/XSL
8,906
社区成员
22,677
社区内容
发帖
与我相关
我的任务
XML/XSL
XML/XSL相关问题讨论专区
复制链接
扫一扫
分享
社区描述
XML/XSL相关问题讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章