Function Name |
ResolvePath | ||||
Category |
File | ||||
Icon |
![]() |
||||
Description |
Resolves the absolute Path from the base path and relative filename | ||||
Inputs |
|
||||
Outputs |
|
||||
Properties |
The Data Mapper ResolvePath function resolves a filename or path relative to the base path provided:
In the following example the filenames taken from the ListFiles component are fed into the XML Readers Filename input. So every filename that ListFiles returns is opened as an XML document:
If we have the following input files in the target folder
Input001.xml |
Copy Code
|
---|---|
<?xml version="1.0" encoding="utf-8"?> <!-- Created with Liquid XML Studio (https://www.liquid-technologies.com) --> <bookstore xmlns="https://www.liquid-technologies.com/sample/bookstore"> <book price="4.99" publicationdate="2008-10-20" ISBN="978-0747596837"> <title>The Graveyard Book</title> <author> <first-name>Neil</first-name> <last-name>Gaiman</last-name> </author> <genre>Horror</genre> </book> <book price="21.99" publicationdate="2002-05-14" ISBN="0-596-00252-1"> <title>XML Schemas</title> <author> <first-name>Eric</first-name> <last-name>van der Vlist</last-name> </author> <genre>Reference</genre> </book> </bookstore> |
Input002.xml |
Copy Code
|
---|---|
<?xml version="1.0" encoding="utf-8"?> <!-- Created with Liquid XML Studio (https://www.liquid-technologies.com) --> <bookstore xmlns="https://www.liquid-technologies.com/sample/bookstore"> <book price="5.99" publicationdate="1999-05-02" ISBN="0-945-16546-1"> <title>The Portable Door</title> <author> <first-name>Tom</first-name> <last-name>Holt</last-name> </author> <genre>Fiction</genre> </book> </bookstore> |
The if the ListFiles function is configured with a pattern say "input*.xml" then the 2 files will be read into the XML Reader and passed onto the writer resulting in;
Output XML |
Copy Code
|
---|---|
<bookstore xmlns="https://www.liquid-technologies.com/sample/bookstore"> <book> <title>The Graveyard Book</title> </book> <book> <title>XML Schemas</title> </book> <book> <title>The Portable Door</title> </book> </bookstore> |
The ListFiles properties values can be edited using the Properties Window.
A range of functions are provided for working with Uri's and Path's. The following example demonstrates how these can be used.
In the following example we have a directory c:\UriExamples\ that contains the files Bookstore.xsd, Input001.xml, Input002.xml & ResolvedUri.Output.xml.
In our transform we have configured "ListFiles" to operate on the directory "c:\UriExamples\" and use the pattern "Input*.xml"
As you can see the ListFiles component gets the full paths of all the files that match the pattern. These filenames are then fed into the various Uri functions and output into an XML writer.
The result of the transform is as follows
Transform Output |
Copy Code
|
---|---|
<FileProperties> <File> <FullFilename>C:\UriExamples\Input001.xml</FullFilename> <Filename>Input001.xml</Filename> <Extension>.xml</Extension> <Path>C:\UriExamples</Path> <AltFullFilename>C:\UriExamples\Backup\Input001.xml</AltFullFilename> <BackupFilename>C:\UriExamples\Input001.xml.bak</BackupFilename> </File> <File> <FullFilename>C:\UriExamples\Input002.xml</FullFilename> <Filename>Input002.xml</Filename> <Extension>.xml</Extension> <Path>C:\UriExamples</Path> <AltFullFilename>C:\UriExamples\Backup\Input002.xml</AltFullFilename> <BackupFilename>C:\UriExamples\Input002.xml.bak</BackupFilename> </File> </FileProperties> |
Let's examine the output in more detail
Native Execution Engine, XSLT 2.0, C#
This is a scalar function so the standard rules apply if multiple values are presented to one or more inputs.