为什么这个xpath失败了

时间:2014-05-07 03:27:57

标签: xslt xpath windward

我有以下xml文件

<applications>
   <application>
      <forms>
          <questions>
              <first_name>
                   My Name
              </first_name>
          </questions>
      </forms>
    </application>
</applications>

首先,我为每个循环运行所有应用程序并为当前应用程序分配变量应用程序。然后我像这样测试每个应用程序:

<wr:if select="${app}/forms/questions/first_name" notEmpty="true">Print this if succeeded</wr:if>

我正在尝试测试first_name标签中是否有文本,但最后我总是有空字符串,我想我的if不成功。你知道我在xpath中犯了错误吗?

1 个答案:

答案 0 :(得分:2)

尝试使用text():

<wr:if select="${app}/forms/questions/first_name/text()" notEmpty="true">Print this if succeeded</wr:if>