Wiki source code of GetNameFile
Last modified by Outhman Moustaghfir on 2024/09/17 13:33
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | === Overview === | ||
2 | |||
3 | The GetNameFile function is used to retrieve the name of a file based on a given file ID. It is integrated within an XSLT transformation process, allowing you to dynamically fetch a file's name during XML transformations. | ||
4 | |||
5 | ==== Function Signature ==== | ||
6 | |||
7 | {{code language="XML"}} | ||
8 | <xsl:variable name="fileName" select="ixf:GetNameFile(fileID)"/> | ||
9 | |||
10 | {{/code}} | ||
11 | |||
12 | |||
13 | * **fileID**: A string representing the ID of the file whose name you want to retrieve. | ||
14 | |||
15 | ==== Usage Example ==== | ||
16 | |||
17 | {{code language="XML"}} | ||
18 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
19 | xmlns:ixf="http://www.ixPath.com/Function" | ||
20 | xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
21 | version="2.0"> | ||
22 | |||
23 | <xsl:output method="xml" indent="yes"/> | ||
24 | |||
25 | <xsl:template match="/"> | ||
26 | <iXDOC> | ||
27 | <!-- Fetch the file name using the GetNameFile function --> | ||
28 | <xsl:variable name="fileName" select="ixf:GetNameFile('63a1baaced01b06706b98537')"/> | ||
29 | |||
30 | <!-- Output the file name --> | ||
31 | <returnedFiles> | ||
32 | <fileName> | ||
33 | <xsl:value-of select="$fileName"/> | ||
34 | </fileName> | ||
35 | </returnedFiles> | ||
36 | </iXDOC> | ||
37 | </xsl:template> | ||
38 | |||
39 | </xsl:stylesheet> | ||
40 | |||
41 | {{/code}} | ||
42 | |||
43 | {{{The result will be the file name.}}} | ||
44 | |||
45 |