I have an XML fragment:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<POSLog xmlns="http://www.nrf-arts.org/IXRetail/namespace/"
xmlns:dtv="http://www.datavantagecorp.com/xstore/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nrf-arts.org/IXRetail/namespace/POSLog.xsd">
<dtv:PosTransactionProperties>
<dtv:PosTransactionPropertyCode><![CDATA[RECEIPT_EMAIL_ADDRESS]]></dtv:PosTransactionPropertyCode>
<dtv:PosTransactionPropertyValue><![CDATA[[email protected]]]></dtv:PosTransactionPropertyValue>
</dtv:PosTransactionProperties>
</POSLog>
And the following XSLT <stylesheet> code, which now copies only data from the specific selected element.
Code:
<xsl:stylesheet version="2.0"
xmlns:dtv="http://www.datavantagecorp.com/xstore/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="//POSLog">
<POSLog>
<xsl:for-each select = "../dtv:PosTransactionProperties[dtv:PosTransactionPropertyCode='RECEIPT_EMAIL_ADDRESS']/dtv:PosTransactionPropertyValue[string-length() > 0]" >
<xsl:copy-of select = "." />
</xsl:for-each>
</POSLog>
</xsl:template>
</xsl:stylesheet>
But, based on my requirement, I need to copy to the output XML entire node <dtv:PosTransactionProperties>, could you, please, advice how to do this copying.