If "match" else



In XSLT I often match nodes using the following command



<xsl:template match="*[local-name() = 'Proposal']/*[local-name() = 'ApplicationData']">


which would get the nodes from



<?xml version="1.0" encoding="utf-8"?><?xfa generator="XFA2_4" APIVersion="2.8.9029.0"?>
<xdp:xdp xmlns:xdp="http://ift.tt/1fDw6Kc" timeStamp="2013-03-01T09:48:58Z" uuid="3e3468da-104d-4532-8077-0dc001ca166b">
<xfa:datasets xmlns:xfa="http://ift.tt/1c7vSVL">
<xfa:data>
<Proposal xmlns="http://ift.tt/1uwmo2V" Version="">
<oneapp:ApplicationData xmlns:oneapp="http://ift.tt/1uwmo2V">
<oneapp:TreesHedgesWales/>
<oneapp:OtherLowCarbonEnergy/>
</oneapp:ApplicationData>
</Proposal>
...


matching



<oneapp:ApplicationData xmlns:oneapp="http://ift.tt/1uwmo2V">
<oneapp:TreesHedgesWales/>
<oneapp:OtherLowCarbonEnergy/>
</oneapp:ApplicationData>


How could I determine whether ApplicationData existed, and if not, insert it?


No comments:

Post a Comment