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 XSLT 1.0不包含(每个_Xml_Xslt_Foreach_Contains - Fatal编程技术网

Xml XSLT 1.0不包含(每个

Xml XSLT 1.0不包含(每个,xml,xslt,foreach,contains,Xml,Xslt,Foreach,Contains,我想包括以下内容: not(contains(country/product/@genericname, 'Color Purple')) 在此中,每个 <xsl:for-each select="country[@name = 'GB']/product[@category = 'inkjet' and contains(@classification, 'consumer') or contains(@classification, 'businessinkjet')]">

我想包括以下内容:

not(contains(country/product/@genericname, 'Color Purple'))
在此
中,每个

<xsl:for-each select="country[@name = 'GB']/product[@category = 'inkjet' and contains(@classification, 'consumer') or contains(@classification, 'businessinkjet')]">
XML:


编辑

这里是正确的道路,谢谢,是错误的道路

<xsl:for-each select="country[@name = 'GB']/product[@category = 'inkjet' and contains(@classification, 'consumer') or contains(@classification, 'businessinkjet')] [not(contains(**@genericname**, 'Stylus Pro'))]">

国家/产品/@genericname

谢谢

not(contains())
需要在谓词中(在方括号内)。在谓词之外,您需要有一个指向节点的路径。发布一个XML代码示例以获得更具体的答案

我猜这可能是你想要的:

<xsl:for-each select="country[@name = 'GB']/product[@category = 'inkjet' and contains(@classification, 'consumer') or contains(@classification, 'businessinkjet')] [not(contains(@genericname, 'Color Purple'))]">
非常不同于:

[not(contains(country/product/@genericname, 'Stylus Pro'))] 
第一个检查当前节点的
genericname
属性

select="country[...]/product[...]"
当前节点是
产品


第二个属性查看名为
product
的节点的
genericname
属性,该节点是当前节点的子节点
country
的子节点。该属性不存在-因此它当然不包含搜索字符串。

@Stefan那么,它是否选择了包含“紫色”的产品在他们的
genericname
属性中?@Stefan请不要在评论中发布代码,而是编辑您的问题。--我不确定您是否看到我的评论:您使用的代码不是我发布的代码。我正在学习…我发布了带有我的改编的真实代码我的目标是:我想排除Stylus Pro
<xsl:for-each select="country[@name = 'GB']/product[@category = 'inkjet' and contains(@classification, 'consumer') or contains(@classification, 'businessinkjet')] [not(contains(@genericname, 'Color Purple'))]">
[not(contains(@genericname, 'Stylus Pro'))]
[not(contains(country/product/@genericname, 'Stylus Pro'))] 
select="country[...]/product[...]"