xsl-list
[Top] [All Lists]

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

2010-04-14 21:56:46
"MK" == Michael Kay <mike(_at_)saxonica(_dot_)com> 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

http://www.saxonica.com/documentation/extensions/functions/base64binarytooctets.html

 MK> which may or may not help you.

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

[...]

-- 
FSF associate member #7257

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--