【问题标题】:variables undeclared when wrapped with CSV serialization使用 CSV 序列化包装时未声明的变量
【发布时间】:2021-08-31 07:09:07
【问题描述】:

我有一个查询在 Basex 9.5.1 中运行于 ftp://ftp.ncbi.nlm.nih.gov//biosample/biosample_set.xml.gz

for $bsattrib in doc(
  'biosample_set'
)/BioSampleSet/BioSample/Attributes/Attribute

let $attribdata := data(
  $bsattrib
)
let $attrib_name := data(
  $bsattrib/@attribute_name
)
let $attrib_hn := data(
  $bsattrib/@harmonized_name
)
let $bs := $bsattrib/../..
let $bsaccession := data(
  $bs/@accession
)

group by $attrib_hn

order by  count(
  $bs
) descending

return <record>
<hname>{$attrib_hn}</hname>
<bs_count>{count($bs)}</bs_count>
</record>

给予

<record>
  <hname/>
  <bs_count>59840</bs_count>
</record>
<record>
  <hname>gap_accession</hname>
  <bs_count>39179</bs_count>
</record>
<record>
  <hname>submitter_handle</hname>
  <bs_count>39179</bs_count>
</record>

等等

当我用它包装时

declare option output:method "csv";
declare option output:csv "header=yes, separator=semicolon";

<csv>

在顶部和

</csv>

在底部,我得到

未声明的变量:$attrib

【问题讨论】:

    标签: xml xquery basex


    【解决方案1】:

    呃,我把 &lt;csv&gt; 标签放错地方了

    return <csv><record>
    <hname>{$attrib_hn}</hname>
    <bs_count>{count($bs)}</bs_count>
    </record></csv>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-04
      • 2014-05-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多