AW: base64

> -----Ursprüngliche Nachricht-----
> Von: Norm Tovey-Walsh <ndw@nwalsh.com>
> Gesendet: Mittwoch, 22. Januar 2025 17:19
> An: Maier, Denis Christian (UB) <denis.maier@unibe.ch>
> Cc: xproc-dev@w3.org
> Betreff: Re: base64
> 
>   <submission>
>     <document id="thing1">base64encodedblob</document>
>     <document id="thing2">anotherbase64encodedblob</document>
>   </submission>
> 
> With Saxon PE in Oxygen, I wouldn't be surprised if you can do this with some
> combination of serialization and some EXPath function, but I've never tried.
> 

Just for the record, I gave it a shot with Saxon PE, and this here seems to work just fine:
               
                <xsl:variable name="html-content-stringified" as="xs:string">
                    <xsl:value-of select="serialize(., map{'method': 'html', 'indent': false()})"/>
                </xsl:variable>
                
                <xsl:variable name="html-content-encoded">
                    <xsl:value-of select="saxon:string-to-base64Binary($html-content-stringified, 'UTF-8')"/> 
                </xsl:variable>

Instead of saxon's own extension function, I could also have used the appropriate function from expath's binary module.

Best,
Denis

Received on Wednesday, 29 January 2025 16:12:10 UTC