Page 1 of 1

Displaying Base64Binary Problem

Posted: Tue Feb 07, 2006 8:44 am
by ivan603
Hi all, i encountered a problem on displaying node value which is in Base64Binary data type when send it to XSL page. The node value is showing belows:

Code: Select all

<MessageTest xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">VABlAHMAdABpAG4AZwA=</MessageTest> 
The original value before convert to binary type is "Testing".

In XSL, when i select the node value:

Code: Select all

<xsl:value-of select=".//MessageTest">
the XSL returned the binary value, "VABlAHMAdABpAG4AZwA=" not "Testing".
Actually my expected output is "Testing".

Does anyone know how to convert the binary data to string in XSL, please help me to solve the problem.

Posted: Tue Feb 07, 2006 11:04 am
by george
Hi Ivan,

Note that base64 encoding encodes a binary value as text. So VABlAHMAdABpAG4AZwA= is not the binary value, is the text and the bytes representing Testing are forming the binary value. Now XSLT does not work at bytes level so you cannot output bytes from XSLT. The only way you can handle this from XSLT is to use some extension function that given a base64 encoded value will decode that to the encoded bytes and then will use the encoding you know was used to extract a text from those bytes and return that text.

Best Regards,
George