Skip to main content

XSLT

Abstract

XSLT

DescriptionXSLT (uv-t-xslt):

This DPU performs XSL transformation over input files, using a single static template. The outcome of the transformation will be in file format.

This DPU supports random UUID generation using randomUUID() function in namespace uuid-functions.

Example usage:

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet xmlns:uuid="uuid-functions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> 
<xsl:template match="/"> 
<xsl:value-of select="uuid:randomUUID()"/> 
</xsl:template> 
</xsl:stylesheet>
Configuration Parameters

Name

Description

Example

Skip file on error

If selected and the transformation fails, then the file is skipped and the execution continues.

False

File extension

If provided then the file extension in virtual path is set to the given value.

If no virtual path is set then an error message is logged and no virtual path is set.

.xml

Number of extra threads

How many additional workers should be created. One worker thread is always created even if the value is set to zero.

Remember that a higher number of workers may speed up transformation but will also result in greater memory consumption.

This option should work better with files that takes longer to transform.

2

XSLT template

The template used during the transformation.

Inputs and Outputs

Name

Type

DataUnit

Description

Required

files

i

FilesDataUnit

File/s to be transformed

(tick)

files

o

FilesDataUnit

Transformed file of given type

(tick)

config

i

RdfDataUnit

Dynamic DPU configuration, see Advanced configuration

Advanced Configuration

It is also possible to dynamically configure the DPU over its input config using RDF data.

Configuration sample:

<http://localhost/resource/config> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://linked.opendata.cz/ontology/uv/dpu/xslt/Config>; 
<http://linked.opendata.cz/ontology/uv/dpu/xslt/fileInfo> <http://localhost/resource/fileInfo/0>;
<http://linked.opendata.cz/ontology/uv/dpu/xslt/outputFileExtension> “.ttl”.


<http://localhost/resource/fileInfo/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://linked.opendata.cz/ontology/uv/dpu/xslt/FileInfo>;
<http://linked.opendata.cz/ontology/uv/dpu/xslt/param> <http://localhost/resource/param/0>; 
<http://unifiedviews.eu/DataUnit/MetadataDataUnit/symbolicName> “smlouva.ttl”.


<http://localhost/resource/param/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://linked.opendata.cz/ontology/uv/dpu/xslt/Param>; 
<http://linked.opendata.cz/ontology/uv/dpu/xslt/param/name> “paramName”; 
<http://linked.opendata.cz/ontology/uv/dpu/xslt/param/value> “paramValue”.
ExamplesTransform Downloaded XML Files

The following image shows a fragment of a pipeline which first downloads an XML file, uses XSLT to transform the file into RDF/XML file, followed by transforming this outputted file into RDF Data. The configuration for the XSLT can be seen below.

24576329.png
24576326.png
Transform XML Data using dynamically configured input config data

Using the above sample config I can construct the input for our next example. Allowing me to use RDF config as my input in place of my file, demonstrated below.

24576328.png
24576327.png