Hide last authors
Outhman Moustaghfir 1.1 1
2
3 === SetFile Method Documentation ===
4
5 ==== Purpose: ====
6
7 The SetFile method is designed to store XML content in a database by saving it as a file and returning the file's unique identifier.
8
9 ==== How it Works: ====
10
11 * The method takes XML content as input.
12 * It writes the XML content to a file.
13 * The file is saved in the database, and its file ID is returned for future reference.
14
15 ==== Usage Example: ====
16
17 Consider the following XSLT transformation that calls the SetFile method:
18
19
20 {{code language="XML"}}
21 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
22 xmlns:ixf="http://www.ixPath.com/Function"
23 xmlns:xs="http://www.w3.org/2001/XMLSchema"
24 xmlns:ix="localFunction"
25 xmlns:fn="http://www.w3.org/2005/xpath-functions"
26 version="2.0">
27
28 <xsl:output method="xml" indent="yes"/>
29
30 <!-- Start of the Transformation -->
31 <xsl:template match="/">
32 <iXDOC>
33 <!-- Define the XML content you want to save -->
34 <xsl:variable name="xmlContent">
35 <MyXML>
36 <XML>
37 <iXDoc>
38 <Invoice>
39 <InvoiceHeader>
40 <InvoiceNumber>123456</InvoiceNumber>
41 <InvoiceDate>2019-01-01</InvoiceDate>
42 <InvoiceDueDate>2019-01-31</InvoiceDueDate>
43 <InvoiceCurrency>USD</InvoiceCurrency>
44 <InvoiceTotal>1000.00</InvoiceTotal>
45 <InvoiceTax>100.00</InvoiceTax>
46 <InvoiceNet>900.00</InvoiceNet>
47 <InvoicePaid>0.00</InvoicePaid>
48 <InvoiceBalance>900.00</InvoiceBalance>
49 <InvoiceStatus>Open</InvoiceStatus>
50 <InvoiceTerms>Net 30</InvoiceTerms>
51 <InvoiceNotes>Thank you for your business!</InvoiceNotes>
52 </InvoiceHeader>
53 <!-- Additional Invoice Items -->
54 </Invoice>
55 </iXDoc>
56 </XML>
57 </MyXML>
58 </xsl:variable>
59
60 <!-- Call the SetFile method and pass the XML content -->
61 <xsl:variable name="fileId" select="ixf:SetFile($xmlContent)"/>
62
63 <!-- Output the ID of the saved file -->
64 <returnedFiles>
65 <fileId>
66 <xsl:value-of select="$fileId"/>
67 </fileId>
68 </returnedFiles>
69 </iXDOC>
70 </xsl:template>
71
72 </xsl:stylesheet>
73
74 {{/code}}
75
76 ==== Output: ====
77
78 The method will return the unique ID of the file saved in the database, which can be accessed as shown in the XSLT example.
79
80 ==== ====
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian