XML mit Substrukturen Import xslt-Filter
Verfasst: Do, 17.02.2011 02:05
Hallo,
nach vielem rumgesuche und Probieren bin ich leider immer noch nicht zu meinem erhoften Ergebnis gekommen.
Ich habe diverse XML-Dateien, welche ich als simple Tabele in OO Calc importieren moechte und von dort aus mit Base eine Datenbank erstellen moechte. Hier einen Ausschnitt der XML:
Mein bisheriger Filteransatz, der leider so nicht funkioneren kann:
Nun zu dem was ich eigentlich erreichen will:
Eine simple Tabelle mit:
id(G1) | title(Α {A}) | description(Vorkommen: 3; Stellen: 3; Übersetzungen: 1) | description/title(Alpha (3x in 3 Stellen))
Ich hoffe es ist verstaendlich ausgedrueckt und nicht zu viel Aufwand. Am besten sollte, wenn moeglich noch eine weitere Aufsplittung stattfinden (zum Beispiel der Description)
Vielen Dank bereits im Vorraus!
Raphi
nach vielem rumgesuche und Probieren bin ich leider immer noch nicht zu meinem erhoften Ergebnis gekommen.
Ich habe diverse XML-Dateien, welche ich als simple Tabele in OO Calc importieren moechte und von dort aus mit Base eine Datenbank erstellen moechte. Hier einen Ausschnitt der XML:
Code: Alles auswählen
<?xml version="1.0" encoding="windows-1252"?>
<dictionary type="x-strong" refbible="any" revision="3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="zefDic1.xsd" dicversion="1.0.0.10">
<item id="G1">
<title>Α {A}</title>
<description>Vorkommen: 3; Stellen: 3; Übersetzungen: 1</description>
<description>
<title>Alpha (3x in 3 Stellen)</title>
<reflink mscope="66;1;8" />; <reflink mscope="66;21;6" />; <reflink mscope="66;22;13" />
</description>
</item>
<item id="G2">
<title>Ἀαρών {Aarōn}</title>
<description>Vorkommen: 5; Stellen: 5; Übersetzungen: 2</description>
<description>
<title>Aarons (3x in 3 Stellen)</title>
<reflink mscope="42;1;5" />; <reflink mscope="58;7;11" />; <reflink mscope="58;9;4" />
</description>
<description>
<title>Aaron (2x in 2 Stellen)</title>
<reflink mscope="44;7;40" />; <reflink mscope="58;5;4" />
</description>
</item>
</dictionary>
Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-
compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">
<office:body>
<office:spreadsheet>
<table:table>
<table:table-row>
<table:table-cell><text:p>item</text:p></table:table-cell>
<table:table-cell><text:p>title</text:p></table:table-cell>
<table:table-cell><text:p>description</text:p></table:table-cell>
<table:table-cell><text:p>description/title</text:p></table:table-cell>
</table:table-row>
<xsl:for-each select="mp3tag/file">
<table:table-row>
<table:table-cell><text:p><xsl:value-of select="item"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="title"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="description"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="description/title"/></text:p></table:table-cell>
</table:table-row>
</xsl:for-each>
</table:table>
</office:spreadsheet>
</office:body>
</office:document-content>
</xsl:template>
</xsl:stylesheet>
Eine simple Tabelle mit:
id(G1) | title(Α {A}) | description(Vorkommen: 3; Stellen: 3; Übersetzungen: 1) | description/title(Alpha (3x in 3 Stellen))
Ich hoffe es ist verstaendlich ausgedrueckt und nicht zu viel Aufwand. Am besten sollte, wenn moeglich noch eine weitere Aufsplittung stattfinden (zum Beispiel der Description)
Vielen Dank bereits im Vorraus!
Raphi