问题标签 [xslt-grouping]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2808 浏览

xslt - 从 xml 中获取不同的值

我的示例 xml 如下所示: 我需要从 xml 中获取不同的状态。我在 vs 2010 编辑器中使用 xslt 1.0。

我的 xslt 如下所示:

输出:DE、NJ、NY

我上面的 xml 看起来很适合上面的测试 xml。

如果我将 xml 更改如下:

它没有选择州DE。任何人都可以提出合适的解决方案。在此先感谢。我需要从 xml 中找出不同的状态。

0 投票
2 回答
348 浏览

xml - 按xslt中的arregate元素属性对组进行排序

我正在使用 xslt(1.0 版,使用 MSXSL)转换一些 xml。

假设我的 xml 数据如下所示:

我的目标是:

  1. 将记录分组<name>
  2. 每组,确定最大值<size>,比如说maxsize
  3. maxsize按组(降序)对组进行排序
  4. 每组,列出记录(按原始顺序)

所以结果可能是:

现在步骤 1、2 和 4,我可以做到。但是...如何按最大大小对组进行排序?

我尝试在包含组的变量中构建一个新节点集。我可以构建这样一个集合,但我只能以字符串的形式访问它。

应该可以吧?

0 投票
1 回答
133 浏览

xslt - XSLT:合并文件,但过程性能更好

我有两个 XML 文件并希望合并,合并的标准如下:

nodes1.xml 文件内容:

nodes2.xml 文件内容:

通过我的 xsl 模板,我得到:

我需要一个解决方案来获得更好的性能。我目前的解决方案是:

我用 java saxon 运行它:

我认为将输入文件同时放在一个变量中是“一种耻辱”,但我想不出有什么不同的做法。

我感谢帮助或指针。

——保利诺

0 投票
2 回答
1034 浏览

xml - XSLT group-by throws an error

The xml is as below:

I want to convert it in a table in html output (not xml output) - using grouping functionality (group by replace).

The code I've written is:

When opened xml file(linked with xslt) in Firefox, it returns "Error during XSLT transformation: XSLT transformation failed."

Can anyone provide me with guidance?

Thanks.

0 投票
1 回答
95 浏览

xml - 如何扩展 Muenchian XML 分组?

我有这个 XML:

感谢hr_117的帮助,我设法做到了:

这给了我这个输出:

但是我怎么能算attendees,所以我得到这个:

有人可以帮忙吗?

谢谢!

0 投票
1 回答
150 浏览

xslt - XSLT grouping items by count

I have the following list of items.

I'm having trouble figuring out the XSLT required so that the above are displayed in groups of Type1(x1), Type2(x2), Type3(x4), where the counts are the number in parenthesis or less. In other words, the goal is to create a repeating pattern: the next item of Type1 if any of those remain, then the next two items of Type2 or fewer if less than two remain, then the next four items of Type3 or fewer if less than four remain.

So the desired output would look something like the below:

From the above output, you can see that the ordering has changed. i.e. there is <=1 Type 1, followed by <=2 Type2, followed by <=4 Type3, and this pattern repeats itself. I suppose the items will need to be grouped into the pattern described and repeat itself until the full list if items are exhausted. I hope I make sense.

Can anyone provide the required XSLT or some pointers please?

Thanks, John.

0 投票
1 回答
258 浏览

xml - 如何在封闭元素下组织(分组)节点 - XSLT

我尝试过使用 XSLT 1.0 对 XML 进行简单的分组,并且效果很好,但是在这里我遇到了一些更复杂且实际上不同的情况。所以XML结构基本上是这样的:

我需要的是对同一位置下的Blocks 和s 进行分组,并删除重复的位置编号。House例如它会变成这样:

比较难,因为Position不是Area的属性,所以我基本上要识别Area的Position的值,然后把同一个Position下的House和Block抓起来,放在同一个包围下<Area> </Area>

0 投票
1 回答
109 浏览

xml - XSLT 无法弄清楚如何正确分组

我有以下从 Oracle-DB 导出的 XML 文件:http: //pastebin.com/0yPcc7HT

我需要将其转换为以下结构:

我已经尝试了很多小时不同的事情,但我就是不知道如何正确地做到这一点。这就是我的 XSLT 文件的样子:

但这给了我以下结果:

PREISLISTEN中的元素SPESEN出现得太频繁了。我做错了什么,我需要改变什么才能让它发挥作用?

先感谢您

0 投票
1 回答
405 浏览

xslt - XSLT 函数 sum() 不计算节点

感谢大家花时间查看我的问题。

当节点值不同时,我无法对节点求和,但如果它相同则可以工作。

这是我的 XML -

这是我的 XSLT -

结果是 75 76。但如果两者都是 75,则结果将是 150。

我似乎是按值分组然后添加它们。我怎样才能让它按它的节点分组,所以上面的 XML 结果将是 151?

0 投票
3 回答
156 浏览

xslt - XSLT 1.0 Grouping

I need to apply XSLT 1.0 transformation to following XML:

to have following output:

How to do that?