Re: [xsl] how to decode Base64 in XSLT?

Subject: Re: [xsl] how to decode Base64 in XSLT?
From: Ivan Shmakov <oneingray@xxxxxxxxx>
Date: Thu, 15 Apr 2010 09:56:14 +0700
>>>>> "MK" == Michael Kay <mike@xxxxxxxxxxxx> writes:

 IS> Now, how do I convert these Base64 strings into the respective
 IS> binary strings?

 MK> It rather depends on what you want the output to be. There's no
 MK> such thing as a "binary string" recognized by the XDM type
 MK> system.

	It looks like I'd need a work-around then.

 MK> Perhaps you want a string in which the one and zero bits are
 MK> represented by Unicode characters "0" and "1"? Or in which the
 MK> octets are represented as a space-separated sequence of decimal
 MK> integers (0-255)?

	There, I need a string composed of the characters which, being
	represented in a chosen unibyte encoding, will correspond to the
	sequence of codes that the Base64 string itself encodes.

	As the XSLT program will have:

  <xsl:output method="text" encoding="UNIBYTE-ENCODING" />

	I guess that the character string thus obtained will be
	translated to the intended byte string in the output.

	(Hopefully the implementation won't do any conversions, such as
	CR/LF to LF or vice versa.)

 MK> Whatever the output you want, there isn't very much in the standard
 MK> function library to help you. Saxon has
 MK> saxon:base64Binary-to-octets


 MK> which may or may not help you.

	It won't, but saxon:base64Binary-to-string () probably will.


FSF associate member #7257

Current Thread