简体   繁体   中英

Why this xpath fails

I have the following xml file

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

First I have a for each loop which runs through all applications and assigns a variable app to a current application. Then I test each application like this:

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

I am trying to test if there is a text in first_name tag, but in the end I always have empty string, I guess my if does not succeed. Do you know if I made a mistake in my xpath?

尝试使用text():

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM