1. Knowledge Base
  2. Find
  3. Metadata & Your Record Schema

Imagen XML Schema Mapping (XSLT) 📕

Transformations (XSLT) mapping files will be required to translate non-Imagen XML files into files that can be read. An example of an XSLT mapping file can be seen below.

A mapping file may be used to choose which legacy fields in your XML file to map to which Imagen metadata fields (e.g., the Overview field in the XML can translate to the Description field in your Imagen database schema

Description><xsl:value-of select="record_meta/Overview"/></ Description> 

Mapping File Examples 

The following example XML file can be translated in various ways, which will be highlighted throughout the following sections.

Example input XML 

<record_meta> 
<Overview>Example Overview</Overview>
<media>
<name>example media</name>
<url_of_file>https://someurl.com/file.mp4</url_of_file>
</media>
<media_tag>
<startTime>00:00:20:30</startTime>
<endTime>00:00:21:00</endTime>
<description>Example</description>
</media_tag>
</record_meta> 

XSLT mapping files

New METADATA only record 

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>

<xsl:template match=".">

<Records>
<ImagenRecord>
<xsl:attribute name="ID">-1</xsl:attribute>
<Fields><!-- Put fields here-->
< Description><xsl:value-of select="record_meta/Overview"/></ Description>
</Fields>
</ImagenRecord>
</Records>

</xsl:template>
</xsl:stylesheet>

New record with media 

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>


<xsl:template match=".">

<Records>
<ImagenRecord>
<xsl:attribute name="ID">-1</xsl:attribute>
<Fields> <!-- Put fields here-->
<Description><xsl:value-of select="normalize-space(record_meta/Overview)"/></Description>
</Fields>
<MediaObject>
<xsl:attribute name="Name">
<xsl:value-of select="record_meta/media/name"/>
</xsl:attribute>
<xsl:attribute name="Version">3</xsl:attribute>
<xsl:attribute name="ID">-1</xsl:attribute>
<xsl:attribute name="MediaType">Video</xsl:attribute>
<xsl:element name="State">new</xsl:element>
<xsl:element name="timecodeFormat">Smpte_25</xsl:element>
<xsl:element name="BaseTimecode">00:00:00:00</xsl:element>
<xsl:element name="MediaElement">
<xsl:attribute name="MediaType">Video</xsl:attribute>
<xsl:attribute name="Index">0</xsl:attribute>
<xsl:element name="OriginalFile"/>
<xsl:value-of select="record_meta/media/url_of_file"/>
</xsl:element>
</MediaObject>
</ImagenRecord>
</Records>

</xsl:template>
</xsl:stylesheet>

New record with media and time-based METADATA (Annotations) 

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:msxsl="urn:schemas-microsoft-com:xslt"                               
exclude-result-prefixes="msxsl">

<xsl:output method="xml" indent="yes"/>

<xsl:template match=".">


<Records>

<ImagenRecord>
<xsl:attribute name="ID">-1</xsl:attribute>

<Fields><!-- Put fields here-->

<Description><xsl:value-of select="normalize-space(record_meta/Overview)"/></ Description>
</Fields>     
<MediaObject>
<xsl:attribute na<xsl:attribute name="Name">
<xsl:value-of select="record_meta/media/name"/>
</xsl:attribute>
<xsl:attribute name="Version">3</xsl:attribute>
<xsl:attribute name="ID">-1</xsl:attribute>
<xsl:attribute name="MediaType">Video</xsl:attribute>
<xsl:element name="State">new</xsl:element>
<xsl:element name="timecodeFormat">Smpte_25</xsl:element>
<xsl:element name="BaseTimecode">00:00:00:00</xsl:element>
<xsl:element name="MediaElement">
<xsl:attribute name="MediaType">Video</xsl:attribute>
<xsl:attribute name="Index">0</xsl:attribute>
<xsl:element name="OriginalFile"/>
<xsl:value-of select="record_meta/media/url_of_file)"/>
</xsl:element>
</xsl:element>
<xsl:for-each select=" record_meta /media_tag">
<MediaAnnotation>
<StartPoint>
<xsl:value-of select=" startTime"/></StartPoint>
<EndPoint><xsl:value-of select=" endTime"/></EndPoint>
<Description><xsl:value-of select=" descrption"/></Description>  
</MediaAnnotation>
</xsl:for-each>
</MediaObject>
</ImagenRecord>
</Records>   

</xsl:template>

</xsl:stylesheet> 

Import XML examples 

The example XML files below could have been output from the mapping files in the previous section, or they could have been created in the Imagen format manually, programmatically, or from legacy systems. 

The following XML examples will show you how to update and create new records:

New metadata-only record, no media 📰

New record with a single piece of media 📰

New record with multiple pieces of media 📰

Record update with new media 📰

Record update with METADATA only 📰


 

👩‍🎓 Now you understand the Imagen XML format, you are ready to start importing records using XML. Either:

👉 Create an XML Import Widget in Imagen web

or

👩‍🔬 The Developers Guide to get started using the API to create/update records using XML