[xsl] Form feed character () in decoded xs:base64Binary

Subject: [xsl] Form feed character () in decoded xs:base64Binary
From: "Martynas Jusevičius martynas@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Jul 2020 17:54:05 -0000
Hi,

I'm transforming large JSON files with some email data using XSLT 3.0.
They contain xs:base64Binary literals which I'm decoding using
bin:decode-string() and want to include the decoded values in the
output XML.

The problem is that some of the decoded string values have illegal XML
1.0 characters in them, such as Form feed (&#xc;).

I want to remove them but cannot find a way.
I can't use translate(., '&#xc;', '') because the stylesheet would not
be well-formed anymore.
I can't even use replace(., codepoints-to-string(12), '') because I
get this error (with Saxon 10.1 EE):

    codepoints-to-string(): invalid XML character [xc]. Found while
atomizing the second argument of fn:replace()

Are there any native XSLT options here?

Thanks.

Current Thread