您将如何从此 xquery 中删除所有文字 [英] How would you remove all literals from this xquery

查看:26
本文介绍了您将如何从此 xquery 中删除所有文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从员工.../员工和经理.../经理的返回中删除文字,以便我可以删除员工.../员工和经理.../经理.我希望结果在结果 xml 中显示时不包含员工和经理.

How can a remove the literals from the return in employee.../employee and manager.../manager so I can delete employee.../employee and manager.../manager. I want the result to display without the employee and manager in the resulting xml.

<results>
      {
        for $depen in doc("../company/dependent.xml")//dependent
        where $depen/dependent_name=*
        return
         <row>
         <dependent name="{$depen/dependent_name}"/>
          {
            for $emp in doc("../company/employee.xml")//employee[ssn = $depen/essn ]
            return

            <employee>

            <emp fname="{$emp/fname}" lname="{$emp/lname}"/>
                  {
                  for $man in doc("../company/employee.xml")//employee[ssn = $emp/superssn ]
                  return


                 <mgr fname="{$man/fname}" lname="{$man/lname}"/>          


                 }              
            </employee> 
          } 
         </row>   
      }
    </results>

推荐答案

我想你想要

<results>
      {
        for $depen in doc("../company/dependent.xml")//dependent
        where $depen/dependent_name=*
        return
         <row>
          <dependent name="{$depen/dependent_name}"/>
          {
            for $emp in doc("../company/employee.xml")//employee[ssn = $depen/essn ]
            return

            (

                  <emp fname="{$emp/fname}" lname="{$emp/lname}"/>,

                  for $man in doc("../company/employee.xml")//employee[ssn = $emp/superssn ]
                  return
                     <mgr fname="{$man/fname}" lname="{$man/lname}"/>          

             )              
          } 
         </row>   
      }
</results>

就语法而言,如果没有上下文,我不确定 $depen/dependent_name=* 的比较是否有意义.

in terms of the syntax, I am not sure the comparison $depen/dependent_name=* makes any sense without having a context.

这篇关于您将如何从此 xquery 中删除所有文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆