Wiki source code of FileToBase64
Version 9.3 by Outhman Moustaghfir on 2024/02/26 17:12
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
7.1 | 1 | = = |
2 | |||
![]() |
1.1 | 3 | = FileToBase64 = |
4 | |||
![]() |
4.1 | 5 | |
6 | This function encodes a file into Base64 format. | ||
7 | |||
8 | = Uses = | ||
9 | |||
![]() |
8.1 | 10 | The syntax to be used : FileToBase64//**({connectorAlias} )**// |
![]() |
4.1 | 11 | |
![]() |
6.1 | 12 | where : |
![]() |
4.1 | 13 | |
![]() |
6.1 | 14 | * connectorAlias: the alias used in the scenario to define a connector. (SplitXML1 , AlertJob2 ...) |
![]() |
4.1 | 15 | |
16 | ==== Examples ==== | ||
17 | |||
18 | [[image:fileTObase64.png]] | ||
19 | |||
20 | In this example, we send an XML file and try to encode a file. | ||
21 | |||
22 | the XSL used : | ||
23 | |||
![]() |
7.1 | 24 | {{code language="xml"}} |
25 | <?xml version="1.0" encoding="utf-8"?> | ||
26 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:ixf="http://www.ixPath.com/Function" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ix="localFunction" xmlns:fn="http://www.w3.org/2005/xpath-functions" > | ||
![]() |
8.1 | 27 | <xsl:output method="xml" indent="yes"></xsl:output> |
![]() |
7.1 | 28 | <!-- Beginning of the Translation --> |
29 | <xsl:template match="/"> | ||
30 | <ixDOC> | ||
![]() |
8.1 | 31 | <TEST><xsl:value-of select="ixf:FileToBase64('FtpListener1')"></xsl:value-of></TEST> |
![]() |
7.1 | 32 | </ixDOC> |
33 | </xsl:template> | ||
34 | </xsl:stylesheet> | ||
35 | {{/code}} | ||
![]() |
4.1 | 36 | |
![]() |
4.2 | 37 | Upon execution, a file is generated, containing the encoded value of the file in base 64 format, enclosed within the 'TEST' tag |
![]() |
4.1 | 38 | |
![]() |
7.1 | 39 | {{code language="xml"}} |
40 | <?xml version="1.0" encoding="UTF-8"?> | ||
41 | <ixDOC xmlns:ixf="http://www.ixPath.com/Function" | ||
42 | xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
43 | xmlns:ix="localFunction" | ||
44 | xmlns:fn="http://www.w3.org/2005/xpath-functions"> | ||
45 | <TEST>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCg0KICAgPGl4RG9jPg0KICAgIA0KCQ0KCTxNZXNzYWdlIHNlbGVjdD0gIkEubnVtYmVyLEMuTkFNRSBBUyBuYW1lc3RlLEIuTkFNRSBBUyBuYW1lY2xpZW50LCBBLnNvdXJjZSwgQS5jcmVhdGVkICwgRC5zdWJqZWN0ICIgICANCgkgICAgICAgICBmcm9tID0ib3N0X3RpY2tldCBBIEpPSU4gb3N0X3VzZXIgQiBKT0lOIG9zdF9vcmdhbml6YXRpb24gQyBKT0lOIG9zdF90aWNrZXRfX2NkYXRhIEQiIA0KCSAgICAgICAgIHdoZXJlPSIoKEIuaWQ9QS51c2VyX2lkKSBhbmQgKEIub3JnX2lkPUMuaWQpKWFuZCAoRC50aWNrZXRfaWQgPSBBLnRpY2tldF9pZCkgIg0KCSAgICAgICAgID4NCgkNCgk8L01lc3NhZ2U+DQoJDQogIDwvaXhEb2M+</TEST> | ||
46 | </ixDOC> | ||
![]() |
4.1 | 47 | {{/code}} |