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
Β