Input XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="trans.xsl"?>
<rootecf>
<XBRL>
<Name>Akhil</Name>
</XBRL>
<PI20>
<Address>Villa</Address>
</PI20>
</rootecf>
Output XML:
<?xml version="1.0"?>
<rootecf>
<XBRL>
<Name>Akhil</Name>
<PI20Addres>Villa</PI20Addres>
</XBRL>
What I am trying to do here is that in the output XML i am creating a new tag called <PI20Addres>
with the value of the PI20/Address
tag. The important point here is that I do not want the XBRL
tag to be hardoced in the output XML
as i have hardcoded PI20Adress
tag, but instead it should be read from the input XML
and coped as it is.
The reason i am saying is that the XBRL
tag will be having namespaces that will change randomly in the incoming XML
, so I have to copy the tag rather than hardcoding it.
Can anyone please tell me how can I achieve this with XSL
?
trans.xsl
can look like this:This will return the requested output when applied to the single example you have provided:
XSLT 1.0