View Single Post
  #3 (permalink)  
Old May 24th, 2018, 05:22 AM
Martin Honnen Martin Honnen is offline
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

If you move to XSLT 2 or even 3 with Saxon 9 you can ease your task of matching elements in a namespace and of copying everything except the nodes for which you write templates with
Code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xpath-default-namespace="http://schemas.microsoft.com/dynamics/2011/01/documents/Message"
    expand-text="yes"
	version="3.0">

  <xsl:mode on-no-match="shallow-copy"/>
  
  <xsl:template match="DocumentDestinationPartner">
      <xsl:copy>{. || '#D'}</xsl:copy>
  </xsl:template>
  
  <xsl:template match="DocumentDestinationPartner[contains(., '#D')]">
      <xsl:copy>{. || 'D'}</xsl:copy>
  </xsl:template>
  
</xsl:stylesheet>
Online sample at https://xsltfiddle.liberty-development.net/pPqsHTg
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Reply With Quote
The Following User Says Thank You to Martin Honnen For This Useful Post:
Neal (May 24th, 2018)