我用XSL解析XSL文件。我有一個動態查找節點的問題。下面是這種情況:XSL:動態選擇節點
<linkbase xmlns="http://www.xbrl.org/2003/linkbase" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd">
<labelLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:role="http://www.xbrl.org/2003/role/link" xlink:type="extended">
<loc xlink:type="locator" xlink:href="de-gaap-ci-2010-12-16.xsd#de-gaap-ci_bs.ass.fixAss.fin.otherLoans.other" xlink:label="de-gaap-ci_bs.ass.fixAss.fin.otherLoans.other"/>
<!-- many <loc... elements -->
<labelArc xlink:from="de-gaap-ci_bs.ass.fixAss.fin.otherLoans.other" xlink:to="label_de-gaap-ci_bs.ass.fixAss.fin.otherLoans.other" priority="1" xlink:arcrole="http://www.xbrl.org/2003/arcrole/concept-label" xlink:type="arc"/>
<!-- many <labelArc... elements -->
</labelLink>
</linkbase>
我解析的labelArc
元素,並希望包括來自loc
元素的信息。這與SAP/ABAP做...
我的XSL代碼如下:
<xsl:template match="lb:labelArc">
<xsl:variable name="arc_to" select="@xlink:to"/>
<TY_T_LABELARC>
<LOC> <xsl:value-of select="//lb:loc[@xlink:label='$arc_to']/@xlink:href"/> </LOC>
<FROM> <xsl:value-of select="@xlink:from"/> </FROM>
<TO> <xsl:value-of select="@xlink:to"/> </TO>
<!-- Other values follow -->
</TY_T_LABELARC>
</xsl:template>
我想包括從loc
標籤到輸出的@href
。我可以找到相應的loc
標籤,其值爲@to
,每個標籤的值爲labelArc
。
我的問題是,這個語句返回空值:
<xsl:value-of select="//lb:loc[@label='$arc_to']/@href"/>
我與領先的命名空間試過都「的XLink:」每個屬性,沒有它...
任何想法?
感謝您指出我錯過「label_」的錯誤!你隱含地解決了我以前沒有認識到的另一個我的問題:-) – 2012-04-28 22:21:49
@MarcoNätlitz:不客氣。 – 2012-04-28 22:25:44