<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:dp="http://www.datapower.com/extensions"
  extension-element-prefixes="dp"
>
  <dp:input-mapping  href="store:///pkcs7-convert-input.ffd" type="ffd"/>

  <xsl:output omit-xml-declaration="yes" />
    
  <xsl:template match="/">
    <xsl:variable name="input64" 
      select="dp:binary-encode(/object/message/node())"
    />
    <!-- this does UTF-8 validation and decoding -->
    <xsl:variable name="str" select="dp:decode($input64, 'base-64')"/>

    <response>
      <rc>
        <xsl:value-of select="dp:http-response-header('x-dp-response-code')"/>
      </rc>
      <body>
        <xsl:value-of select="$str"/>
      </body>
    </response>
  </xsl:template>
  
</xsl:stylesheet>