Decode base64 and write out binary stream
Added by Anonymous over 17 years ago
Legacy ID: #4466374 Legacy Poster: Yves Forkl (yvesforkl)
I am using Saxon (8.8.0.4J) to extract base64-encoded images from a WordprocessingML file. When writing out the result of applying saxon:base64Binary-to-octets to my base64 binary image data, xsl:result-document (using a "text" method output format) creates a file that contains the octets as space-separated decimal values instead of actual bytes. Both of these give the same result: <xsl:sequence select="saxon:base64Binary-to-octets($embedded_pict_base64)"/> <xsl:value-of select="saxon:base64Binary-to-octets($embedded_pict_base64)"/> How can I serialize the sequence of octets directly into byte values of my output files, not into decimal numbers? Yves
Replies (1)
RE: Decode base64 and write out binary stream - Added by Anonymous over 17 years ago
Legacy ID: #4466425 Legacy Poster: Michael Kay (mhkay)
The text output method will only output text - what you really need is a binary output method. Unfortunately though, a serializer can only serialize a result tree, and a result tree cannot contain binary data. I think your best bet is to process the result tree using a Java application, and have the Java application do the base64 decoding as it writes to an OutputStream. Michael Kay http://www.saxonica.com/
Please register to reply