2014-05-07 52 views
-1

我有下面的XML文件爲什麼這個XPath失敗

<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標籤文本,但最終我總是空的字符串,我想我如果不會成功。你知道我是否在xpath中犯了錯誤?

回答

2

儘量使用文字():

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