Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.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 “替代方案”;以“结束”;xsl中的语法_Xml_Xslt_Xslt 1.0 - Fatal编程技术网

Xml “替代方案”;以“结束”;xsl中的语法

Xml “替代方案”;以“结束”;xsl中的语法,xml,xslt,xslt-1.0,Xml,Xslt,Xslt 1.0,从该来源引用 ends with不适用于XPATH 1.0,但我需要它的函数来处理我的应用程序 这是我需要匹配特定精确字符串的代码片段 <xsl:template match="p:Project/p:ItemGroup/p:Reference[starts-with(@Include, 'Common')]/@Include"> 在这一行中,我尝试将其修改为这样以实现所需的输出,因为出现了异常“ends with syntax不是XPATH 1.0的一部分” 有没有别

从该来源引用

ends with不适用于XPATH 1.0,但我需要它的函数来处理我的应用程序

这是我需要匹配特定精确字符串的代码片段

<xsl:template match="p:Project/p:ItemGroup/p:Reference[starts-with(@Include, 'Common')]/@Include">

在这一行中,我尝试将其修改为这样以实现所需的输出,因为出现了异常“ends with syntax不是XPATH 1.0的一部分”



有没有别的办法

我需要完成这项工作,因为要修改的xml文件中有一些部分在开始时有“Common”字符串,比如Common.UI、Common.Windows.Grid,所以在运行时,它也会影响这些行


它应该只更改只有“Common”的那一个

公式已经在您给出的链接中说明了。由于您懒得分析,请测试以下内容:

<xsl:template match="p:Project/p:ItemGroup/p:Reference[starts-with(@Include, 'Common') and 'Common' = substring(@Include, string-length() - 5)]/@Include">

除非我有误解,否则如果您试图“仅更改具有公共的一个”,那么您可以执行
<xsl:template match="p:Project/p:ItemGroup/p:Reference[starts-with(@Include, 'Common') and 'Common' = substring(@Include, string-length() - 5)]/@Include">