No, this can only be done using an extension function (or some very tortuous
low-level code). This is true even in XSLT 2.0/XPath 2.0, which supports the
xs:base64Binary data type but doesn't provide any function to get from a
sequence of octets to a base64Binary value.
I found that the following works with my current build of Saxon 8.1:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
xmlns:b64="net.sf.saxon.value.Base64BinaryValue"
exclude-result-prefixes="b64">
  <xsl:template match="/">
    <out>
      <a><xsl:value-of
select="b64:new(string-to-codepoints('Müller'))"/></a> 
    </out>      
  </xsl:template>  
</xsl:stylesheet>
Unfortunately it doesn't work with Saxon 8.0 because the mapping of an XPath
sequence of integers to a Java byte[] array isn't picked up: a different
constructor is selected instead. The basic code is there in Saxon, but
you'll have to write a Java wrapper method to invoke it.
I'll probably package this as a documented extension function in due course.
Michael Kay  
-----Original Message-----
From: Michael Wiedmann [mailto:michael(_dot_)wiedmann(_at_)detewe(_dot_)de] 
Sent: 19 August 2004 10:05
To: XSL List
Subject: [xsl] Encoding base64 with XSLT
An XML based addressbook has to be converted to LDIF (LDAP Data
Interchange Format, RFC 2849) using an XSLT-stylesheet. LDIF does not 
allow non-ASCII characters, they have to be base64-encoded.
E.g. given an element
<lastname>Müller</lastname>
has to be written like
sn:: TfxsbGVy
instead of simply:
sn: Müller
Is there any way to encode base64 with XSLT
Michael
--+------------------------------------------------------------------
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>
--+--