【问题标题】:XPath query not returning results during vs2010 publication在 vs2010 发布期间 XPath 查询不返回结果
【发布时间】:2012-09-12 05:33:11
【问题描述】:

我正在使用内置 xdt 的 vs 2010 发布一个网站。我知道转换正在起作用,因为 web.config 的其他元素正在转换。

这是给我带来问题的转换语句:

<param name="ssrsServiceUrl" value="thevalue" xdt:Locator="XPath   (/configuration/unity/container/register[@name='ReportingRegistration']/constructor/param[@name='ssrsServiceUrl'])" xdt:Transform="SetAttributes(value)"/>

这是配置文件(仅相关部分)

<?xml version="1.0"?>
<configuration>
 <unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
  <container>
   <register name="ReportingRegistration" type="IMyType" mapTo="MyType">
    <lifetime type="singleton"/>
    <constructor>
     <param name="ssrsServiceUrl" value="foovalue"/>
    </constructor>
   </register>
  </container>
 </unity>
</configuration>

web.config 中有多个参数我省略了。

【问题讨论】:

    标签: xpath xdt-transform


    【解决方案1】:

    原来,问题出在统一块中定义的命名空间。我把它拿出来解决了这个问题。我不完全确定它为什么会这样做。我相信这是对 .net 中 XPath 查询解析器实现的限制,而不是 XPath 本身。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多