Introduction

This function decodes a base64 encoded file. 

Uses

The syntax to be used : AddFileBase64(${node} , {fileName})

where : 

  • node: is the XML node containing the encoded file.
  • fileName: file name with extension. ( file.pdf, document.xml ...) 

Examples

2023-04-03_14h20_22.png

In this example, we send an XML file and try to decode a file.

the XSL used : 

<?xml version="1.0" encoding="windows-1251"?>
<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">
<xsl:output method="xml" indent="yes"/>
<!-- Beginning of the Translation -->
<xsl:template match="/">
<xsl:variable name="xml">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGlYRE9DIHhtbG5zOml4Zj0iaHR0cDovL3d3dy5peFBhdGguY29tL0Z1bmN0aW9uIgogICAgICAgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIgogICAgICAgeG1sbnM6aXg9ImxvY2FsRnVuY3Rpb24iPgogICA8dGVzdD4yMTIxMk1vcm9jY29DYXNhYmxhbmNhPC90ZXN0Pgo8L2lYRE9DPgo=</xsl:variable>
<iXDOC>
  <test><xsl:value-of select="ixf:AddFileBase64($xml , 'NewXML.xml')"/></test>
 </iXDOC>
</xsl:template>
</xsl:stylesheet>

and the output will include the file ID created in the database : 

<?xml version="1.0" encoding="UTF-8"?>
<iXDOC xmlns:ixf="http://www.ixPath.com/Function"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:ix="localFunction">
  <test>642ad89203be0522b6ede668</test>
</iXDOC>

you will find the created file at the work directory. for our case :

<?xml version="1.0" encoding="UTF-8"?>
<iXDOC xmlns:ixf="http://www.ixPath.com/Function"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:ix="localFunction">
  <test>21212MoroccoCasablanca</test>
</iXDOC>
Tags:
    
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian