add attribute into existing XML [XSL] - XML/XSL - Programmation
MarshPosté le 30-03-2005 à 08:42:53
voici mon autre probleme
I need to add the attribute "version" in the wap-provisioningdoc node. How can I do this using the following XSL? This XSL gets rid of the node characteristic of type SETTINGSET.
Marsh Posté le 30-03-2005 à 08:42:53
voici mon autre probleme
I need to add the attribute "version" in the wap-provisioningdoc node. How can I do this using the following XSL? This XSL gets rid of the node characteristic of type SETTINGSET.
current XSL
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl utput method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()[not(@type='SETTINGSET')]"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Input XML
<wap-provisioningdoc>
<characteristic type="SETTINGSET">
<parm name="NAME" value="NOKIA-6170"/>
<parm name="STATE" value="2"/>
<parm name="SERVICE" value="WAPGPRS"/>
</characteristic>
<characteristic type="PXLOGICAL">
<parm name="TRUST"/>
<parm name="MASTER"/>
<parm name="STARTPAGE" value="http://www.bank.com/startpage.wml"/>
</characteristic>
<characteristic type="NAPDEF1">
<parm name="INTERNET"/>
</characteristic>
<characteristic type="APPLICATION">
<characteristic type="RESOURCE">
<parm name="STARTPAGE"/>
</characteristic>
</characteristic>
<characteristic type="ACCESS">
<parm name="RULE"/>
</characteristic>
</wap-provisioningdoc>
Result expected:
<wap-provisioningdoc version="1.0">
<characteristic type="PXLOGICAL">
<parm name="TRUST"/>
<parm name="MASTER"/>
<parm name="STARTPAGE" value="http://www.bank.com/startpage.wml"/>
</characteristic>
<characteristic type="NAPDEF1">
<parm name="INTERNET"/>
</characteristic>
<characteristic type="APPLICATION">
<characteristic type="RESOURCE">
<parm name="STARTPAGE"/>
</characteristic>
</characteristic>
<characteristic type="ACCESS">
<parm name="RULE"/>
</characteristic>
</wap-provisioningdoc>
Thanks