XSLT Transformation Pipeline - Content Management
XSLT Transformation Pipeline
Kaltura supports two XSLT mechanisms for transforming metadata XML automatically.
Profile-Level XSLT (Auto-Applied)
Attach an XSLT to a profile so it auto-transforms every metadata.add and metadata.update:
curl -X POST "$KALTURA_SERVICE_URL/service/metadata_metadataProfile/action/updateTransformationFromFile" \
-d "ks=$KALTURA_KS" \
-d "format=1" \
-d "id=$PROFILE_ID" \
-F "xsltFile=@transform.xslt"
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Profile ID to attach the XSLT to |
xsltFile | file | Yes | XSLT stylesheet file (multipart form field) |
How it works:
- Attach XSLT via
metadataProfile.updateTransformationFromFile - On every
metadata.addandmetadata.update, the server transforms incoming XML using the XSLT before validation - The XSLT receives
KALTURA_CURRENT_TIMESTAMP(Unix timestamp) as a parameter - Transformed XML is validated against the XSD, then saved
- If the transformation produces invalid output:
XSLT_VALIDATION_ERROR
Example XSLT — auto-set a LastModified timestamp on every update:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="KALTURA_CURRENT_TIMESTAMP"/>
<xsl:template match="@*|node()">
<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</xsl:template>
<xsl:template match="metadata/LastModified">
<LastModified><xsl:value-of select="$KALTURA_CURRENT_TIMESTAMP"/></LastModified>
</xsl:template>
</xsl:stylesheet>
One-Time XSLT Update
Transform existing metadata XML using a one-time XSLT via metadata.updateFromXSL (see section 6.10). The server reads the current XML, applies the XSLT, validates, and saves. Uses locking for concurrency safety.
Scheduled Task XSLT
Automated XSLT transforms via KalturaExecuteMetadataXsltObjectTask scheduled tasks. Enables periodic normalization, field migration, and computed field updates across all metadata instances matching a filter.