---
title: XSLT Transformation Pipeline
url: https://docs.kaltura.com/docs/rich-media-cms-apis/content-management/custom-metadata-xslt-transformation-pipeline
---

## 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`:


```bash
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:**
1. Attach XSLT via `metadataProfile.updateTransformationFromFile`
2. On every `metadata.add` and `metadata.update`, the server transforms incoming XML using the XSLT before validation
3. The XSLT receives `KALTURA_CURRENT_TIMESTAMP` (Unix timestamp) as a parameter
4. Transformed XML is validated against the XSD, then saved
5. If the transformation produces invalid output: `XSLT_VALIDATION_ERROR`

**Example XSLT** — auto-set a `LastModified` timestamp on every update:


```xml
<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.
