<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"/>
  <dp:output-mapping href="store:///pkcs7-convert-input.ffd" type="ffd"/>
 
  <xsl:variable name="input64" 
    select="dp:binary-encode(/object/message/node())"/>

  <xsl:template match="/">
    <object>
      <message>
        <!-- log data hexadecimally encoded -->
        <xsl:message dp:priority="error">
          <xsl:value-of 
            select="substring(
                      dp:radix-convert(concat('8AAA',$input64),64,16),
                      7
                    )"
          />
        </xsl:message>

        <!-- "binary" identity transform -->
        <xsl:copy-of select="dp:binary-decode($input64)"/>
      </message>
    </object>
  </xsl:template>
</xsl:stylesheet>