Skip to content
Snippets Groups Projects
Commit 398660ad authored by moogdo49's avatar moogdo49
Browse files

neue Datei: XSL/Holzschnitte1.py

	neue Datei:             XSL/Holzschnitte1.xml
	neue Datei:             XSL/Holzschnitte1.xsl
	neue Datei:             XSL/holzschnitt.xsd
parent 42f9a5d9
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from lxml import builder
from lxml import etree
xml_input = etree.parse("./mkg_lido--mkgddb-sub-hack-profil_20170310 .xml")
xslt_root = etree.parse("./Holzschnitte1.xsl")
transform = etree.XSLT(xslt_root)
newdom = transform(xml_input)
f = file('./Holzschnitte1.xml', 'w')
#f.write(buffer)
print >>f, etree.tostring(newdom, pretty_print=True)
f.close()
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lido="http://www.lido-schema.org">
<xsl:strip-space element="root" />
<xsl:output method="xml"/>
<!-- Root -->
<xsl:template match="/">
<root>
<xsl:apply-templates/>
</root>
</xsl:template>
<!-- einzelne Objekte -->
<xsl:template match="lido:lido">
<xsl:choose>
<xsl:when test="./lido:descriptiveMetadata/lido:objectClassificationWrap/lido:objectWorkTypeWrap/lido:objectWorkType/lido:term[contains(@lido:pref, 'preferred')] = 'Holzschnitt'">
<object>
<xsl:apply-templates/>
</object>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- ID -->
<xsl:template match="lido:lidoRecID">
<recID>
<xsl:value-of select="."/>
</recID>
</xsl:template>
<xsl:template match="lido:conceptID">
</xsl:template>
<!-- Metadaten -->
<xsl:template match="lido:descriptiveMetadata">
<descriptiveMetadata>
<xsl:apply-templates/>
</descriptiveMetadata>
</xsl:template>
<!-- Objektdaten Material -->
<xsl:template match="lido:objectClassificationWrap">
<objectClassification>
<xsl:apply-templates/>
</objectClassification>
</xsl:template>
<xsl:template match="lido:objectWorkTypeWrap">
<objectWorkType>
<xsl:attribute name="type">
<xsl:value-of select="./lido:objectWorkType[@lido:type]"/>
</xsl:attribute>
<xsl:value-of select="./lido:objectWorkType/lido:term"/>
</objectWorkType>
</xsl:template>
<xsl:template match="lido:classificationWrap">
<classification>
<xsl:attribute name="type">
<xsl:value-of select="./lido:classification[@lido:type]"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="./lido:classification/lido:term[@lido:pref = 'preferred']">
<xsl:value-of select="./lido:classification/lido:term"/>
</xsl:when>
</xsl:choose>
</classification>
</xsl:template>
<!-- Objektdaten Inhalt -->
<xsl:template match="lido:objectIdentificationWrap">
<objectIdentification>
<xsl:apply-templates/>
</objectIdentification>
</xsl:template>
<xsl:template match="lido:titleWrap">
<titleSet>
<xsl:attribute name="type">
<xsl:value-of select="./lido:titleSet[@lido:type]"/>
</xsl:attribute>
<title>
<xsl:value-of select="./lido:titleSet/lido:appellationValue"/>
</title>
</titleSet>
</xsl:template>
<xsl:template match="lido:inscriptionsWrap"/>
<xsl:template match="lido:repositoryWrap"/>
<xsl:template match="lido:objectDescriptionWrap"/>
<xsl:template match="lido:objectMeasurementsWrap/lido:objectMeasurementsSet/lido:displayObjectMeasurements">
<displayObjectMeasurements>
<xsl:value-of select="."/>
</displayObjectMeasurements>
</xsl:template>
<!-- event -->
<xsl:template match="lido:eventWrap">
<eventWrap>
<xsl:apply-templates/>
</eventWrap>
</xsl:template>
<xsl:template match="lido:eventType">
<type>
<xsl:value-of select="./lido:term"/>
</type>
</xsl:template>
<!-- Künstler -->
<xsl:template match="lido:eventActor">
<actor>
<xsl:attribute name="type">
<xsl:value-of select="./lido:actorInRole/lido:actor[@lido:type]"/>
</xsl:attribute>
<name>
<xsl:value-of select="./lido:actorInRole/lido:actor/lido:nameActorSet/lido:appellationValue"/>
</name>
<geburtsjahr>
<xsl:value-of select="./lido:actorInRole/lido:actor/lido:vitalDatesActor/lido:earliestDate"/>
</geburtsjahr>
<todesjahr>
<xsl:value-of select="./lido:actorInRole/lido:actor/lido:vitalDatesActor/lido:latestDate"/>
</todesjahr>
<roleActor>
<xsl:value-of select="./lido:actorInRole/lido:roleActor/lido:term"/>
</roleActor>
</actor>
</xsl:template>
<!-- Datum -->
<xsl:template match="lido:eventDate">
<eventDate>
<datum>
<xsl:value-of select="lido:displayDate"/>
</datum>
<earliest>
<xsl:value-of select="lido:date/lido:earliestDate"/>
</earliest>
<latest>
<xsl:value-of select="lido:date/lido:latestDate"/>
</latest>
</eventDate>
</xsl:template>
<!-- Ort -->
<xsl:template match="lido:eventPlace">
<eventPlace>
<xsl:value-of select="lido:displayPlace"/>
</eventPlace>
</xsl:template>
<xsl:template match="lido:eventMaterialsTech">
<materialsTech>
<xsl:attribute name="type">
<xsl:value-of select="./lido:materialsTech/lido:termMaterialsTech[@lido:type]"/>
</xsl:attribute>
<xsl:value-of select="./lido:materialsTech/lido:termMaterialsTech/lido:term"/>
</materialsTech>
</xsl:template>
<xsl:template match="lido:objectRelationWrap/lido:subjectWrap">
<subjectWrap>
<subject>
<xsl:attribute name="type">
<xsl:value-of select="./subjectSet/lido:subject[@lido:type]"/>
</xsl:attribute>
<term>
<xsl:value-of select="./subjectSet/lido:subject/lido:subjectConcept/lido:term"/>
</term>
</subject>
</subjectWrap>
</xsl:template>
<xsl:template match="lido:administrativeMetadata">
<recordLink>
<xsl:value-of select="lido:recordWrap/lido:recordInfoSet/lido:recordInfoLink"/>
</recordLink>
<resource>
<resourceLink>
<xsl:value-of select="lido:resourceWrap/lido:resourceSet/lido:resourceRepresentation/lido:linkResource"/>
</resourceLink>
</resource>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:element name="object">
<xs:complexType>
<xs:sequence>
<xs:element name="recID" type="xs:string">
<xs:complexType>
<xs:attribute name="recIDSource" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- descriptiveMetadata-->
<xs:element name="descriptiveMetadate">
<xs:complexType>
<!-- descriptiveMetadata/objectClassification -->
<xs:element name="objectClassification">
<xs:complexType>
<!-- descriptiveMetadata/objectClassification/objectWorkType-->
<xs:element name="objectWorkType" type="xs:string"/>
<!-- descriptiveMetadata/objectClassification/classification-->
<xs:element name="classification" type="xs:string">
<xs:complexType>
<xs:attribute name="type" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
<!-- descriptiveMetadata/objectIdentification-->
<xs:element name="objectIdentification">
<xs:complexType>
<!-- descriptiveMetadata/objectIdentification/titleSet-->
<xs:element name="titleSet">
<xs:complexType>
<xs:attribute name="type" type="xs:string"/>
<!-- descriptiveMetadata/objectIdentification/titleSet/title-->
<xs:element name="title" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- descriptiveMetadata/objectIdentification/displayObjectMeasurements-->
<xs:element name="displayObjectMeasurements" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- descriptiveMetadata/eventWrap -->
<xs:element name="eventWrap">
<xs:complexType>
<!-- descriptiveMetadata/eventWrap/type -->
<xs:element name="type" type="xs:string"/
>
<!-- descriptiveMetadata/eventWrap/actor -->
<xs:element name="actor">
<xs:complexType>
<xs:attribute name="type" type="string"/>
<!-- descriptiveMetadata/eventWrap/actor/name -->
<xs:element name="name" type="xs:string"/>
<!-- descriptiveMetadata/eventWrap/actor/geburtsjahr -->
<xs:element name="geburtsjahr" type="xs:positiveInteger"/>
<!-- descriptiveMetadata/eventWrap/actor/todesjahr -->
<xs:element name="todesjahr" type="xs:positiveInteger">
<!-- descriptiveMetadata/eventWrap/actor/roleActor -->
<xs:element name="roleActor" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- descriptiveMetadata/eventWrap/eventDate -->
<xs:element name="eventDate">
<xs:complexType>
<!-- descriptiveMetadata/eventWrap/eventDate/datum -->
<xs:element name="datum" type="xs:string"/>
<!-- descriptiveMetadata/eventWrap/eventDate/earliest -->
<xs:element name="earliest" type="xs:positiveInteger"/>
<!-- descriptiveMetadata/eventWrap/eventDate/latest -->
<xs:element name="latest" type="xs:positiveInteger">
</xs:complexType>
</xs:element>
<!-- descriptiveMetadata/eventWrap/eventPlace -->
<xs:element name="eventPlace" type="xs:string"/>
<!-- descriptiveMetadata/eventWrap/materialsTech -->
<xs:element name="materialsTech" type="xs:string">
<xs:complexType>
<xs:attribute name="type" type="xs:string">
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
<!-- descriptiveMetadata/subjectWrap -->
<xs:element name="subjectWrap">
<xs:complexType>
<!-- descriptiveMetadata/subjectWrap/subject -->
<xs:element name="subject">
<xs:complexType>
<xs:attribute name="type" type="xs:string"/>
<!-- descriptiveMetadata/subjectWrap/subject/term -->
<xs:element name="term" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
<!-- recordLink -->
<xs:element name="recordLink" type="xs:string"/>
<!-- resource -->
<xs:element name="resource">
<xs:complexType>
<!-- resource/resourceLink -->
<xs:element name="resourceLink" type="xs:string"/>
<!-- resource/resourceThumbnail -->
<xs:element name="resourceThumbnail" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:complexType>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment