Show last authors
1 = Introduction =
2
3 This function decodes a base64 encoded file.
4
5 = Uses =
6
7 (% class="box infomessage" %)
8 (((
9 The syntax to be used : //**AddFileBase64(${node} , {fileName})**//
10 )))
11
12 where :
13
14 * node: is the XML node containing the encoded file.
15 * fileName: file name with extension. ( file.pdf, document.xml ...)
16
17 ==== Examples ====
18
19 [[image:2023-04-03_14h20_22.png]]
20
21 In this example, we send an XML file and try to decode a file.
22
23 the XSL used :
24
25 {{code language="XML"}}
26 <?xml version="1.0" encoding="windows-1251"?>
27 <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">
28 <xsl:output method="xml" indent="yes"/>
29 <!-- Beginning of the Translation -->
30 <xsl:template match="/">
31 <xsl:variable name="xml">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGlYRE9DIHhtbG5zOml4Zj0iaHR0cDovL3d3dy5peFBhdGguY29tL0Z1bmN0aW9uIgogICAgICAgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIgogICAgICAgeG1sbnM6aXg9ImxvY2FsRnVuY3Rpb24iPgogICA8dGVzdD4yMTIxMk1vcm9jY29DYXNhYmxhbmNhPC90ZXN0Pgo8L2lYRE9DPgo=</xsl:variable>
32 <iXDOC>
33 <test><xsl:value-of select="ixf:AddFileBase64($xml , 'NewXML.xml')"/></test>
34 </iXDOC>
35 </xsl:template>
36 </xsl:stylesheet>
37 {{/code}}
38
39 and the output will include the file ID created in the database :
40
41 {{code language="XML"}}
42 <?xml version="1.0" encoding="UTF-8"?>
43 <iXDOC xmlns:ixf="http://www.ixPath.com/Function"
44 xmlns:xs="http://www.w3.org/2001/XMLSchema"
45 xmlns:ix="localFunction">
46 <test>642ad89203be0522b6ede668</test>
47 </iXDOC>
48
49 {{/code}}
50
51 you will find the created file at the work directory. for our case :
52
53 {{code language="XML"}}
54 <?xml version="1.0" encoding="UTF-8"?>
55 <iXDOC xmlns:ixf="http://www.ixPath.com/Function"
56 xmlns:xs="http://www.w3.org/2001/XMLSchema"
57 xmlns:ix="localFunction">
58 <test>21212MoroccoCasablanca</test>
59 </iXDOC>
60
61 {{/code}}
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian