Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 从一个元素到另一个元素制作聊天表_Xml_Xslt_Xpath - Fatal编程技术网

Xml 从一个元素到另一个元素制作聊天表

Xml 从一个元素到另一个元素制作聊天表,xml,xslt,xpath,Xml,Xslt,Xpath,输入文件: <?xml version="1.0" encoding="UTF-8"?> <root> <a> <notice>100</notice> <chat>10, 20, 30, 40</chat> </a> <a> <notice>101</notice> &

输入文件:

    <?xml version="1.0" encoding="UTF-8"?>
<root>
    <a>
        <notice>100</notice>
        <chat>10, 20, 30, 40</chat>
    </a>
    <a>
        <notice>101</notice>
        <chat>40, 50, 60</chat>
    </a>
    <a>
        <notice>102</notice>
        <chat>10, 30, 60</chat>
    </a>
    <a>
        <notice>103</notice>
        <chat>70, 10, 20</chat>
    </a>
</root>
我的要求是输入聊天记录并查找生效通知,如以下示例所示:

    <a>
    <chat>10</chat>
    <notice>100, 102, 103</notice>    
</a>

<a>
    <chat>20</chat>
    <notice>100, 103</notice>    
</a>

<a>
    <chat>30</chat>
    <notice>100, 102</notice>    
</a>

注意:我必须使用XSLT的1.0版本。

如果您确实限于XSLT 1.0,则必须分三个步骤执行此操作:

标记聊天值。理想情况下,在这一步结束时 将有一个包含以下内容的变量:

<item notice="100" chat="10"/>
<item notice="100" chat="20"/>
<item notice="100" chat="30"/>
<item notice="100" chat="40"/>
<item notice="101" chat="40"/>
<item notice="101" chat="50"/>
<item notice="101" chat="60"/>
<item notice="102" chat="10"/>
<item notice="102" chat="30"/>
<item notice="102" chat="60"/>
<item notice="103" chat="70"/>
<item notice="103" chat="10"/>
<item notice="103" chat="20"/>
使用EXSLT函数或支持的其他类似函数将变量转换为节点集 你的处理器

使用按聊天室属性对项目进行分组

这里有很多例子说明如何执行每个步骤。如果您遇到问题,请发布一个特定的问题


请注意,一些XSLT处理器支持一些扩展函数,这些函数在这里可能会有所帮助—特别是:and.

为什么输出中缺少chat 40、50、60和70?另外,您将使用哪种XSLT1.0处理器?我想要不同的聊天以及受影响的通知;我只是展示了一个例子,因此这些40、50等都不见了。我需要在1.0版XSLT中实现这个逻辑;saxon处理器如果您使用的是saxon,为什么仅限于XSLT1.0?下面是应用程序依赖关系。我们的应用程序只支持1.0。谢谢对不起,我不明白。应用程序中是否包含处理器?如果是,它是哪个处理器供应商和版本?