Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.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中的值_Xml_Xslt - Fatal编程技术网

Xml 动态更改xslt中的值

Xml 动态更改xslt中的值,xml,xslt,Xml,Xslt,我在xslt 2.0中工作,代码中有这样一行代码: <xsl:value-of select="//dbquery[@id='INLIJVING']//rows/row[@BudgetaryEnvelop_Year = $RefBef][1]/@BudgetaryEnvelop_Year"/></xsl:variable> <xsl:value-of select="//dbquery[@id='INLIJVING']//rows/row[$target = $R

我在xslt 2.0中工作,代码中有这样一行代码:

<xsl:value-of select="//dbquery[@id='INLIJVING']//rows/row[@BudgetaryEnvelop_Year = $RefBef][1]/@BudgetaryEnvelop_Year"/></xsl:variable>
<xsl:value-of select="//dbquery[@id='INLIJVING']//rows/row[$target = $RefBef][1]/@BudgetaryEnvelop_Year"/></xsl:variable>
<xsl:value-of>
    <xsl:attribute name="select">//dbquery[@id='INLIJVING']//rows/row[<xsl:value-of select="$target"/>=<xsl:value-of select="$RefBef"/>][1]/@BudgetaryEnvelop_Year</xsl:attribute>
</xsl:value-of>
但这不起作用。它不执行的
值。我试着像这样传递它:

<xsl:value-of select="//dbquery[@id='INLIJVING']//rows/row[@BudgetaryEnvelop_Year = $RefBef][1]/@BudgetaryEnvelop_Year"/></xsl:variable>
<xsl:value-of select="//dbquery[@id='INLIJVING']//rows/row[$target = $RefBef][1]/@BudgetaryEnvelop_Year"/></xsl:variable>
<xsl:value-of>
    <xsl:attribute name="select">//dbquery[@id='INLIJVING']//rows/row[<xsl:value-of select="$target"/>=<xsl:value-of select="$RefBef"/>][1]/@BudgetaryEnvelop_Year</xsl:attribute>
</xsl:value-of>

//dbquery[@id='inliving']//行/行[=][1]/@BudgetaryEnvelop\u年

但这也不行。

如果要比较变量指定的属性,请尝试以下操作:

row[ @*[ name() = $attrName ] = $RefBef ]
@*
匹配任何属性,嵌套谓词过滤名为
$attrName
的属性。(因此,
$attrName
不应包含
@
字符。)


如果要动态计算整个表达式,则需要扩展函数。查看问题。

如果要比较变量指定的属性,请尝试以下操作:

row[ @*[ name() = $attrName ] = $RefBef ]
@*
匹配任何属性,嵌套谓词过滤名为
$attrName
的属性。(因此,
$attrName
不应包含
@
字符。)


如果要动态计算整个表达式,则需要扩展函数。查看问题。

尝试类似的XPath

<xsl:value-of select="//dbquery[@id='INLIJVING']//rows/row/@*[local-name()=$target]/../@BudgetaryEnvelop_Year"/>


@*
返回
的所有属性,然后根据属性的名称进行过滤。这使得XPath选择的属性不是所需的属性,因此我们使用
提升回
,并进入所需的
@BudgetaryEnvelop\u Year
属性

<xsl:value-of select="//dbquery[@id='INLIJVING']//rows/row/@*[local-name()=$target]/../@BudgetaryEnvelop_Year"/>

@*
返回
的所有属性,然后根据属性的名称进行过滤。这使得XPath选择的属性不是所需的属性,因此我们使用
提升回
,并进入所需的
@BudgetaryEnvelop\u Year
属性