How to check IDREFS length in xPath

南笙酒味 提交于 2019-12-14 04:08:24

问题


I have the next DTD definition

    <!ELEMENT testNode EMPTY>
    <!ATTLIST testNode
          listOfNodes IDREFS #REQUIRED
          bestNode IDREF #REQUIRED
    >

when I get /testNode/@listOfNodes I have to check if there are more then one ref in listOfNodes. How can I do this ?


回答1:


If you have multiple IDREF vlues in attribute listOfNodes, it must be separated by space as per DTD rules. So, you may follow this example to check multiple values:

let $x := <testNode listOfNodes="d1 d2"/>
return
  if(contains($x/@listOfNodes, ' '))
  then "Yes"
  else "No"

For multiple value it will return "Yes" otherwise "No"



来源:https://stackoverflow.com/questions/16980015/how-to-check-idrefs-length-in-xpath

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!