使用XSL-T排除第一个孩子 [英] Exclude first child with XSL-T

查看:93
本文介绍了使用XSL-T排除第一个孩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是相当简单,但我找不到的方式。

What I'm trying to do is fairly simple, but I can't find the way to. I just want to iterate over the children of a node excluding the first child.

例如,在这个XML片段中,我想要所有的 < bar> 元素,除了第一个:

For instance, in this XML snippet, I would want all the <bar> elements, except the first one:

<foo>
    <Bar>Example</Bar>
    <Bar>This is an example</Bar>
    <Bar>Another example</Bar>
    <Bar>Bar</Bar>
</foo>

没有可以过滤的通用属性(如 id 标签或类似的东西。)

There is no common attribute by which I can filter (like an id tag or something similar).

有任何建议吗?

推荐答案

xsl:当时可以随时使用 position

<xsl:when test="node[position() > 1]">
  <!-- Do my stuff -->
</xsl:when>

这篇关于使用XSL-T排除第一个孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆