Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 从定义了名称空间的XBRL获取属性值_Xml_Xpath_Xquery - Fatal编程技术网

Xml 从定义了名称空间的XBRL获取属性值

Xml 从定义了名称空间的XBRL获取属性值,xml,xpath,xquery,Xml,Xpath,Xquery,但I-2063的预期值没有达到。 如何从上述文件中获取属性contextRef的值?如果要返回属性的值,请使用$x/*[local-name()=“xbrl”]/*[local-name()=“Assets”]/@contextRef/string() 当然,XQuery还允许您处理名称空间,因此您不需要local-name()“hacks”: 谢谢你,马丁·霍恩。我使用return$x/*[local-name()=“xbrl”]/*[local-name()=“Assets”]/@conte

但I-2063的预期值没有达到。
如何从上述文件中获取属性contextRef的值?

如果要返回属性的值,请使用
$x/*[local-name()=“xbrl”]/*[local-name()=“Assets”]/@contextRef/string()

当然,XQuery还允许您处理名称空间,因此您不需要
local-name()
“hacks”:


谢谢你,马丁·霍恩。我使用return$x/*[local-name()=“xbrl”]/*[local-name()=“Assets”]/@contextRef/string()得到了响应。现在,我很清楚了。@SarvagyaPant我要重申Martin在这里指出的,声明和使用名称空间是最佳实践。在他们周围工作的黑客可能会产生意想不到的后果。使用
本地名称
是众所周知的。
<!-- Mapping from Excel to XBRL -->
<xbrl xmlns="http://www.xbrl.org/2003/instance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xbrldt="http://xbrl.org/2005/xbrldt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:ifrs="http://xbrl.ifrs.org/taxonomy/2013-03-28/ifrs">
<link:schemaRef xlink:type="simple" xlink:href="IFRS\ifrs-cor_2013-03-28.xsd"/>
<!-- Contexts -->
<context id="D-2063">
    <entity>
        <identifier scheme="http://www.cro.gov.np">CRO</identifier>
    </entity>
    <period>
        <startDate>2063-04-01</startDate>
        <endDate>2064-03-31</endDate>
    </period>
</context>
<context id="I-2063">
    <entity>
        <identifier scheme="http://www.cro.gov.np">CRO</identifier>
    </entity>
    <period>
        <instant>2064-03-31</instant>
    </period>
</context>
<!-- Units -->
<unit id="U-Monetary">
    <measure>iso4217:NPR</measure>
 </unit>  
<!-- Fact values -->  
<ifrs:Assets contextRef="I-2063" unitRef="U-Monetary" decimals="0">7954664475</ifrs:Assets>
</xbrl>  
  xquery version "3.0";
  let $x:=doc("/db/Siddhartha/2061.xml")
  return $x/*[local-name()="xbrl"]/*[local-name()="Assets"][@contextRef]
xquery version "3.0";
declare default element namespace "http://www.xbrl.org/2003/instance";
declare namespace ifrs = "http://xbrl.ifrs.org/taxonomy/2013-03-28/ifrs";
let $x:=doc("/db/Siddhartha/2061.xml")
return $x/xbrl/ifrs:Assets/@contextRef/string()