I'm new to XSLT and I don't know how to accomplish the following.
Below is a part of a xbrl document, generated by another program. Via XSLT, I would like to add an extra element at the position of my comment line:
<xbrli:context id="ctx1">
[...]
</xbrli:context>
//Insert a new element here!
<bd-ob-tuple:TaxData>
[...]
</bd-ob-tuple:TaxData>
At that location, I would like to add the following element using XSLT:
<xbrli:unit id="EUR">
<xbrli:measure>iso4217:EUR</xbrli:measure>
</xbrli:unit>
So that the final result will be:
<xbrli:context id="ctx1">
[...]
</xbrli:context>
<xbrli:unit id="EUR">
<xbrli:measure>iso4217:EUR</xbrli:measure>
</xbrli:unit>
<bd-ob-tuple:TaxData>
[...]
</bd-ob-tuple:TaxData>
(The xbrli:context
element has only one occurence in the whole document, so that perhaps makes it easier to locate the mentioned position for the new element?)
Is there a way I can accomplish this via XSLT?
How about this:
This transformation:
when applied on the following XML document (cleaning and wrapping the provided text to make it well-formed):
produces the wanted, correct result:
Explanation: Use of the identity rule, overriden for
xbrli:context
.