java - 从 xml 文件执行验证时出错

标签 java xml xpath saxon xbrl

我正在尝试执行验证以验证 xbrl 文件。但出现以下错误。

Error on line 351 of *module with no systemId*:
XPST0017: Cannot find a matching 1-argument function named
{http://www.xbrl.org/2010/function/formula}has-fallback-value()

XML 文件:

    <?xml version="1.0" encoding="utf-8"?>
<?taxonomy-version 1.0.4.0 ?> <?taxonomy-set-overall-version 2.8.0.0 ?>
<!--(C) EBA-->
<link:linkbase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xbrli="http://www.xbrl.org/2003/instance" 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns:link="http://www.xbrl.org/2003/linkbase" 
xmlns:gen="http://xbrl.org/2008/generic" 
xmlns:label="http://xbrl.org/2008/label" 
xmlns:xff="http://www.xbrl.org/2010/function/formula"
xmlns:va="http://xbrl.org/2008/assertion/value" 
xmlns:eba_dim="http://www.eba.europa.eu/xbrl/crr/dict/dim" 
xmlns:eba_BA="http://www.eba.europa.eu/xbrl/crr/dict/dom/BA" 
xmlns:df="http://xbrl.org/2008/filter/dimension" 
xmlns:variable="http://xbrl.org/2008/variable" 
xmlns:eba_AP="http://www.eba.europa.eu/xbrl/crr/dict/dom/AP"
xmlns:eba_TR="http://www.eba.europa.eu/xbrl/crr/dict/dom/TR" 
xmlns:eba_PU="http://www.eba.europa.eu/xbrl/crr/dict/dom/PU" 
xmlns:eba_RF="http://www.eba.europa.eu/xbrl/crr/dict/dom/RF"
xmlns:eba_IM="http://www.eba.europa.eu/xbrl/crr/dict/dom/IM" 
xmlns:eba_CG="http://www.eba.europa.eu/xbrl/crr/dict/dom/CG" 
xmlns:eba_MC="http://www.eba.europa.eu/xbrl/crr/dict/dom/MC" 
xmlns:eba_BT="http://www.eba.europa.eu/xbrl/crr/dict/dom/BT" 
xmlns:eba_CS="http://www.eba.europa.eu/xbrl/crr/dict/dom/CS" 
xmlns:eba_CA="http://www.eba.europa.eu/xbrl/crr/dict/dom/CA" 
xmlns:eba_met="http://www.eba.europa.eu/xbrl/crr/dict/met" 
xmlns:xff="http://www.xbrl.org/2010/function/formula" 
xmlns:cf="http://xbrl.org/2008/filter/concept" 
xsi:schemaLocation="http://www.xbrl.org/2003/linkbase 
http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd 
http://xbrl.org/2008/generic http://www.xbrl.org/2008/generic-link.xsd 
http://xbrl.org/2008/label http://www.xbrl.org/2008/generic-label.xsd 
http://xbrl.org/2008/assertion/value http://www.xbrl.org/2008/value-
assertion.xsd http://xbrl.org/2008/filter/dimension 
http://www.xbrl.org/2008/dimension-filter.xsd http://xbrl.org/2008/variable 
http://www.xbrl.org/2008/variable.xsd http://xbrl.org/2008/filter/concept 
http://www.xbrl.org/2008/concept-filter.xsd">
  <link:arcroleRef arcroleURI="http://xbrl.org/arcrole/2008/variable-filter" xlink:type="simple" xlink:href="http://www.xbrl.org/2008/variable.xsd#variable-filter" />
  <link:arcroleRef arcroleURI="http://xbrl.org/arcrole/2008/variable-set" xlink:type="simple" xlink:href="http://www.xbrl.org/2008/variable.xsd#variable-set" />
  <link:arcroleRef arcroleURI="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:type="simple" xlink:href="http://www.xbrl.org/2008/variable.xsd#variable-set-filter" />
  <gen:link xlink:type="extended" xlink:role="http://www.xbrl.org/2003/role/link">
    <va:valueAssertion xlink:type="resource" xlink:label="eba_v6209_m" test="if (not(empty($a) or xff:has-fallback-value(QName('','a')))) then ($b &lt;= 12.5 * $c) else (true())" aspectModel="dimensional" implicitFiltering="true" id="eba_v6209_m" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f1" id="eba_v6209_m.f1">
      <df:dimension>
        <df:qname>eba_dim:BAS</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_BA:x9</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f1" complement="false" order="1" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f2" id="eba_v6209_m.f2">
      <df:dimension>
        <df:qname>eba_dim:APR</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_AP:x27</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f2" complement="false" order="2" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f3" id="eba_v6209_m.f3">
      <df:dimension>
        <df:qname>eba_dim:TRI</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_TR:x4</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f3" complement="false" order="3" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f5" id="eba_v6209_m.f5">
      <df:dimension>
        <df:qname>eba_dim:PUR</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_PU:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f5" complement="false" order="4" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f6" id="eba_v6209_m.f6">
      <df:dimension>
        <df:qname>eba_dim:REF</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_RF:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f6" complement="false" order="5" />
    <df:typedDimension xlink:type="resource" xlink:label="eba_v6209_m.f7" id="eba_v6209_m.f7">
      <df:dimension>
        <df:qname>eba_dim:IMI</df:qname>
      </df:dimension>
    </df:typedDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f7" complement="false" order="6" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f22" id="eba_v6209_m.f22">
      <df:dimension>
        <df:qname>eba_dim:IMS</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_IM:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f22" complement="false" order="7" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f23" id="eba_v6209_m.f23">
      <df:dimension>
        <df:qname>eba_dim:CLS</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_CG:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f23" complement="false" order="8" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f24" id="eba_v6209_m.f24">
      <df:dimension>
        <df:qname>eba_dim:SCC</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_MC:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f24" complement="false" order="9" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f25" id="eba_v6209_m.f25">
      <df:dimension>
        <df:qname>eba_dim:SUB</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_MC:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f25" complement="false" order="10" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f26" id="eba_v6209_m.f26">
      <df:dimension>
        <df:qname>eba_dim:HYV</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_BT:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f26" complement="false" order="11" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f27" id="eba_v6209_m.f27">
      <df:dimension>
        <df:qname>eba_dim:MCY</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_MC:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f27" complement="false" order="12" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f28" id="eba_v6209_m.f28">
      <df:dimension>
        <df:qname>eba_dim:CSC</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_CS:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f28" complement="false" order="13" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f29" id="eba_v6209_m.f29">
      <df:dimension>
        <df:qname>eba_dim:CCA</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_CA:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f29" complement="false" order="14" />
    <df:explicitDimension xlink:type="resource" xlink:label="eba_v6209_m.f30" id="eba_v6209_m.f30">
      <df:dimension>
        <df:qname>eba_dim:MRW</df:qname>
      </df:dimension>
      <df:member>
        <df:qname>eba_AP:x0</df:qname>
      </df:member>
    </df:explicitDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f30" complement="false" order="15" />
    <df:typedDimension xlink:type="resource" xlink:label="eba_v6209_m.f31" id="eba_v6209_m.f31">
      <df:dimension>
        <df:qname>eba_dim:INC</df:qname>
      </df:dimension>
    </df:typedDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f31" complement="true" order="16" />
    <df:typedDimension xlink:type="resource" xlink:label="eba_v6209_m.f32" id="eba_v6209_m.f32">
      <df:dimension>
        <df:qname>eba_dim:PBE</df:qname>
      </df:dimension>
    </df:typedDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f32" complement="true" order="17" />
    <df:typedDimension xlink:type="resource" xlink:label="eba_v6209_m.f33" id="eba_v6209_m.f33">
      <df:dimension>
        <df:qname>eba_dim:IRN</df:qname>
      </df:dimension>
    </df:typedDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f33" complement="true" order="18" />
    <df:typedDimension xlink:type="resource" xlink:label="eba_v6209_m.f34" id="eba_v6209_m.f34">
      <df:dimension>
        <df:qname>eba_dim:NED</df:qname>
      </df:dimension>
    </df:typedDimension>
    <variable:variableSetFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set-filter" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.f34" complement="true" order="19" />
    <variable:factVariable xlink:type="resource" xlink:label="eba_v6209_m.a" bindAsSequence="false" fallbackValue="0" id="eba_v6209_m.a" />
    <cf:conceptName xlink:type="resource" xlink:label="eba_v6209_m.a.f4" id="eba_v6209_m.a.f4">
      <cf:concept>
        <cf:qname>eba_met:mi119</cf:qname>
      </cf:concept>
    </cf:conceptName>
    <variable:variableFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="eba_v6209_m.a" xlink:to="eba_v6209_m.a.f4" cover="true" complement="false" order="1" />
    <variable:variableArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.a" name="a" order="1" />
    <variable:factVariable xlink:type="resource" xlink:label="eba_v6209_m.b" bindAsSequence="false" fallbackValue="0" id="eba_v6209_m.b" />
    <cf:conceptName xlink:type="resource" xlink:label="eba_v6209_m.b.f11" id="eba_v6209_m.b.f11">
      <cf:concept>
        <cf:qname>eba_met:mi310</cf:qname>
      </cf:concept>
    </cf:conceptName>
    <variable:variableFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="eba_v6209_m.b" xlink:to="eba_v6209_m.b.f11" cover="true" complement="false" order="1" />
    <variable:variableArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.b" name="b" order="2" />
    <variable:factVariable xlink:type="resource" xlink:label="eba_v6209_m.c" bindAsSequence="false" fallbackValue="0" id="eba_v6209_m.c" />
    <cf:conceptName xlink:type="resource" xlink:label="eba_v6209_m.c.f18" id="eba_v6209_m.c.f18">
      <cf:concept>
        <cf:qname>eba_met:mi119</cf:qname>
      </cf:concept>
    </cf:conceptName>
    <variable:variableFilterArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="eba_v6209_m.c" xlink:to="eba_v6209_m.c.f18" cover="true" complement="false" order="1" />
    <variable:variableArc xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set" xlink:from="eba_v6209_m" xlink:to="eba_v6209_m.c" name="c" order="3" />
  </gen:link>
</link:linkbase>

抛出的异常是:

net.sf.saxon.s9api.SaxonApiException: Cannot find a matching 1-argument function named {http://www.xbrl.org/2010/function/formula}has-fallback-value()

编辑:
撒克逊版本是9.3

XbrlExpressionProcessor 类: 构造函数有以下代码:

net.sf.saxon.s9api.Processor saxonProcessor = new Processor(false);
net.sf.saxon.s9api.XQueryCompiler xqueryCompiler = saxonProcessor.newXQueryCompiler();
registerNamespaces(xqueryCompiler);

registerNamespaces()方法中,xqueryCompiler.declareNamespace()用于声明命名空间。这里我提到了命名空间xff与网址 http://www.xbrl.org/2010/function/formula
evaluateExpression() 方法

XQueryExecutable queryExecutable = xqueryCompiler.compile(toCompile.toString());    //This is the line which throws the error mentioned in the problem
XQueryEvaluator xqueryEvaluator = queryExecutable.load();
/*All the variable values are set in the xQueryEvaluator using
xqueryEvaluator.setExternalVariable(new QName(memberName), value)*/
XdmValue xqueryResult = xqueryEvaluator.evaluate();

StringBuilder对象toCompile提供Saxon处理器的所有函数定义。
它包含以下数据:

declare function iaf:sum($params as item()*) as item()+ {    let $facts := if (empty($params)) then (0) else one-or-more($params)  let $values := for $i in $facts return (iaf:splitValueThreshold($i)[1])  let $thresholds := for$iin $facts return (iaf:splitValueThreshold($i)[2])  let $sumValues := sum($values)  let $sumThresholds := sum($thresholds)  let $output := iaf:joinValueThreshold($sumValues, $sumThresholds)        return ($output)    };
declare function iaf:numeric-equal($paramA as item(), $paramB as item()) as xs:boolean {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB) let $output := abs($itemA[1] - $itemB[1]) le ($itemA[2] + $itemB[2])        return ($output)};
declare function iaf:numeric-less-than($paramA as item(), $paramB as item()) as xs:boolean {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := ($itemA[1] - $itemB[1]) lt ($itemA[2] + $itemB[2])        return ($output)     };
declare function iaf:numeric-less-equal-than($paramA as item(), $paramB as item()) as xs:boolean {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := ($itemA[1] - $itemB[1]) le ($itemA[2] + $itemB[2])       return ($output)     };
declare function iaf:numeric-greater-than($paramA as item(), $paramB as item()) as xs:boolean {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := $itemA[1] gt ($itemB[1] - ($itemA[2] + $itemB[2]))        return ($output)     };
declare function iaf:numeric-greater-equal-than($paramA as item(), $paramB as item()) as xs:boolean {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := $itemA[1] ge ($itemB[1] - ($itemA[2] + $itemB[2]))       return ($output)     };
declare function iaf:numeric-add($paramA as item(), $paramB as item()) as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $value := $itemA[1]+$itemB[1]  let $threshold := $itemA[2]+$itemB[2]  let $output := iaf:joinValueThreshold($value,$threshold)        return ($output)     };
declare function iaf:numeric-subtract($paramA as item(), $paramB as item()) as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $value := $itemA[1]-$itemB[1]  let $threshold := $itemA[2]+$itemB[2]  let $output := iaf:joinValueThreshold($value,$threshold)        return ($output)     };
declare function iaf:numeric-divide($paramA as item(), $paramB as item()) as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $A := $itemA[1]  let $B := $itemB[1]  let $deltaA := $itemA[2]  let $deltaB := $itemB[2]  let $AdivB := $A div $B  let $J0 := ($A + $deltaA) div ($B + $deltaB)  let $J1 := ($A + $deltaA) div ($B - $deltaB)  let $J2 := ($A - $deltaA) div ($B + $deltaB)  let $J3 := ($A - $deltaA) div ($B - $deltaB)  let $threshold := max((abs($AdivB - $J0), abs($AdivB - $J1), abs($AdivB - $J2), abs($AdivB - $J3)))  let $output := iaf:joinValueThreshold($AdivB, $threshold)        return ($output)     };
declare function iaf:numeric-multiply($paramA as item(), $paramB as item()) as item() {  iaf:multiply-two-elements($paramA, $paramB)};
declare function iaf:numeric-multiply($params as item()+) as item() {    let $output := iaf:multiply-recursive($params, 1, 0)        return ($output)     };
declare function iaf:abs($input as item() as item() {    let $item := if (empty($input)) then 0 else $input  let $output := if ($item instance of element() and empty($item[2])) then    iaf:joinValueThreshold(abs($item), iaf-int:fact-threshold($item)) else (if (not($item instance of    element()) and empty($item[2]) and not(contains(string($item), ";"))) then    iaf:joinValueThreshold(abs($item), 0) else    iaf:joinValueThreshold(abs(xs:decimal(substring-before($item, ";"))),    xs:decimal(substring-after($item, ";"))))         return ($output)     };
declare function iaf:numeric-unary-minus($item as item()) as item() {    let $output := if ($item instance of element() and empty($item[2])) then    iaf:joinValueThreshold(-($item), iaf-int:fact-threshold($item)) else (if (not($item instance of    element()) and empty($item[2]) and not(contains(string($item), ";"))) then    iaf:joinValueThreshold(-($item), 0) else    iaf:joinValueThreshold(-(xs:decimal(substring-before($item, ";"))),    xs:decimal(substring-after($item, ";"))))         return ($output)     };
declare function iaf:min($params as item()*) as item() {    let $facts := if (empty($params)) then (0) else one-or-more($params)  let $values := for $i in $facts return (iaf:splitValueThreshold($i)[1])  let $thresholds := for $i in $facts return (iaf:splitValueThreshold($i)[2])  let $minValue := min($values)  let $indexMin := index-of($values, $minValue)[1]  let $minThreshold := $thresholds[$indexMin]  let $output := iaf:joinValueThreshold($minValue,$minThreshold)        return ($output)     };
declare function iaf:max($params as item()*) as item() {    let $facts := if (empty($params)) then (0) else one-or-more($params)  let $values := for $i in $facts return (iaf:splitValueThreshold($i)[1])  let $thresholds := for $i in $facts return (iaf:splitValueThreshold($i)[2])  let $maxValue := max($values)  let $indexMax := index-of($values, $maxValue)[1]  let $maxThreshold := $thresholds[$indexMax]  let $output := iaf:joinValueThreshold($maxValue,$maxThreshold)        return ($output)     };
declare function iaf:splitValueThreshold($item as item()) as item()+ {  let $valorUmbral := if ($item instance of element() and empty($item[2])) then ($item,    iaf-int:fact-threshold($item)) else (if (not($item instance of element()) and empty($item[2])   and not(contains(string($item), ";"))) then ($item, 0) else    (xs:decimal(substring-before($item, ";")), xs:decimal(substring-after($item, ";"))))        return ($valorUmbral)     };
declare function iaf:joinValueThreshold($value as item(), $threshold as item()) as xs:string {    let $output := concat(string($value),";",string($threshold))        return ($output)     };
declare function iaf:precision($item as item()+) as xs:decimal {    let $ouput := xfi:decimals($item)        return ($ouput)     };
declare function iaf:multiply-recursive($sequence as item()+, $count as item(), $subtotalParam as item()) as item() {    let $facts := if (empty($sequence)) then (0) else    one-or-more($sequence)  let $numberOfParams := count($facts)  let $subtotal := if ($count eq 1) then $facts[1] else $subtotalParam  let $multiply := if($count lt $numberOfParams) then iaf:multiply-two-elements($subtotal,    $facts[$count + 1]) else $subtotal  let $output := if($count lt $numberOfParams) then iaf:multiply-recursive($sequence,    ($count +1), $multiply) else $multiply        return ($output)     };
declare function iaf:multiply-two-elements($paramA as item(), $paramB as item()) as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $A := $itemA[1]  let $B := $itemB[1]  let $deltaA := $itemA[2]  let $deltaB := $itemB[2]  let $AxB := $A * $B  let $threshold := sum((abs($A * $deltaB), abs($B * $deltaA), $deltaA * $deltaB))        return (iaf:joinValueThreshold($AxB, $threshold))     };
declare function iaf:numeric-equal-threshold($paramA as item(), $paramB as item()) as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := ($itemA[2] + $itemB[2])        return ($output)     };
declare function iaf:numeric-less-than-threshold($paramA as item(), $paramB as item()) as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := ($itemA[2] + $itemB[2])        return ($output)     };
declare function iaf:numeric-less-equal-than-threshold($paramA as item(), $paramB as item() as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := ($itemA[2] + $itemB[2])        return ($output)     };
declare function iaf:numeric-greater-than-threshold($paramA as item(), $paramB as item()) as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := ($itemA[2] + $itemB[2])        return ($output)     };
declare function iaf:numeric-greater-equal-than-threshold($paramA as item(), $paramB as item()) as item() {    let $itemA := iaf:splitValueThreshold($paramA)  let $itemB := iaf:splitValueThreshold($paramB)  let $output := ($itemA[2] + $itemB[2])        return ($output)     };
declare function iaf:abs-sequence($params as item()*) as item()+ {    let $facts := if (empty($params)) then (0) else one-or-more($params)  let $values := for $i in $facts return (iaf:abs($i))        return (($values))     };
declare function iaf:numeric-equal-test($paramA as item(), $paramB as item()) as item()+ {    let $valueA := iaf:splitValueThreshold($paramA)[1]  let $valueB := iaf:splitValueThreshold($paramB)[1]  let $thA := iaf:splitValueThreshold($paramA)[2]  let $thB := iaf:splitValueThreshold($paramB)[2]  let $absol := abs($valueA - $valueB)  let $sumTh := $thA + $thB        return (($valueA, $valueB, $thA, $thB, $absol, $sumTh))     };
declare function iaf-int:exp10($power as xs:integer) as xs:decimal {  if ($power eq 0) then 1 else if ($power gt 0) then 10 * iaf-int:exp10($power - 1) else 1 div iaf-int:exp10(-$power)};
declare function iaf-int:fact-threshold($fact as item()) as xs:decimal {    let $decimals := xfi:decimals($fact)       return (if (string($decimals) = 'INF') then 0 else iaf-int:exp10(-xs:integer($decimals)) div 2)};
declare function xfi:decimals($fact as item() ) as item()+ { let $deci := $fact/@decimals  return ($deci)};
declare function xfi:fact-typed-dimension-value($fact as item() , $typedDim as xs:QName?) as xs:string {let $dimName := substring-before(substring-after($fact,concat("s2c_dim:",$typedDim,"__TDVALUE__")),";") return ($dimName)};
declare variable $a external; 
declare variable $b external; 
declare variable $c external; 
if (not(empty($a) or xff:has-fallback-value(QName('','a')))) then ($b <= 12.5 * $c) else (true())

在上面的定义中,最后 4 行,我们定义了测试中使用的变量,最后一行是表达式本身。

如果需要更多信息或这有帮助,请告诉我。

最佳答案

我无法告诉您出了什么问题(因为这不是您向我们展示的 XML 文档...),但我可以建议一些诊断操作。

  1. 您说您正在执行“验证”,但不清楚您的意思。这是 XSLT、XPath、XSD 吗?我们需要知道您正在执行什么。

  2. 这段代码过去有用过吗?如果是这样,那就有明确的证据表明问题与您运行它的方式有关:最有可能的罪魁祸首是不正确的类路径。

  3. 函数的名称{http://www.xbrl.org/2010/function/formula}has-fallback-value()使用的是“抽象”URI,而不是而不是直接标识 Java 类(类似于 {java:net.sf.xbrl.Formula}has-fallback-value())。这意味着撒克逊人只有被告知去哪里寻找才能找到它。您正在运行的程序必须以某种方式向 Saxon 注册此扩展。找到此代码(或其文档)并查看它可能会失败的原因。

  4. 有一个 Saxon 配置选项,用于获取有关扩展函数加载的诊断信息。在 XSLT 命令行上,它是 -TJ,如果您使用 Java API,那么它是配置属性 FeatureKeys.TRACE_EXTERNAL_FUNCTIONS。这向您显示了 Saxon 为查找匹配的外部函数而采取的步骤,这反过来又向您显示了搜索失败之前的情况:例如,它是否找到了匹配的类,但找不到匹配的方法。鉴于这不是直接标识 Java 类的 URI,我并不乐观这会透露太多信息,但值得一试。

  5. 检查您正在使用的 saxon 版本,并查看其是否与您正在运行的应用程序的文档一致。

关于java - 从 xml 文件执行验证时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51532775/

相关文章:

java - XPath 返回一个元素但不返回另一个元素?

python - 从网站上的表格中获取数据

python - NoSuchElementException : Message: Unable to locate element while trying to locate an element using Selenium and Python

java - 使用 Joda Time 打印时舍入毫秒数

java - 获取 Formatter.format() String 中占位符的数量

java - 应用程序因 java.lang.stackOverflow 异常而崩溃

java - 使用 RESTEasy 在服务器端接受 XML

java - 如何使用java-xslt方法处理多个文件?

java - 是否有关于 SwingX-WS 1.1 及其开发状态的任何 [un] 官方信息?

xslt - 如何选择没有特定父节点作为祖先的子节点?