Thank you both...
You both helped me overcome the main problem. I still have an issue with the 'MessageParts' output. Please can either of you assist?
Michael - I have updated using your advise and the result worked great for the 'DocumentDestinationPartner'.
Martin - I am bound by company protocol and there is no plans to move to 2.0 in the near future but thanks for your help.
The updated XSLT file
HTML Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<!--<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>-->
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<!-- -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<!-- Identity template : copy all text nodes, elements and attributes -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- -->
<!-- 1. Append '#D' or 'D'-->
<xsl:template match="m:DocumentDestinationPartner">
<xsl:copy>
<xsl:choose>
<xsl:when test="contains(., '#D')">
<xsl:value-of select="concat(., 'D')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(., '#D')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>
<!-- -->
<xsl:template match="text()">
<xsl:value-of select="normalize-space()" />
</xsl:template>
<!-- -->
</xsl:stylesheet>
The MessageParts element is still outputting as
HTML Code:
<MessageParts>
i.e. it is missing the attribute. How can I resolve this to retain the original?
HTML Code:
<MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
Thanks in advance,