schorschi123
Grünschnabel
Hallo liebe Forengemeinde!
Zurzeit kämpfe ich mit einer XSL Transformation. Ziel der Transformation soll es sein, einen Knoten einer bestehenden XML-Datei mitsamt seiner "Kinderknoten" zu kopieren und in eine neue XML-Datei zu schreiben. Die Ausgangsdatei sieht dabei bspw. wie folgt aus:
Kopiert werden soll nun alles unter und einschließlich des Tags
Ich habe über folgende Befehle versucht den entsprechenden Teil des Originals zu kopieren – jedoch ohne Erfolg:
Meine weiteren "Untersuchungen" haben ergeben, dass die Transformation funktioniert, wenn ich die Namenräume aus dem Workbook-Tag entferne. Könnt ihr mir sagen wie ich meinen XSL-Code anpassen muss, damit die Transformation auch mit den Namenräumen funktioniert?
Im Voraus schon vielen Dank!
Zurzeit kämpfe ich mit einer XSL Transformation. Ziel der Transformation soll es sein, einen Knoten einer bestehenden XML-Datei mitsamt seiner "Kinderknoten" zu kopieren und in eine neue XML-Datei zu schreiben. Die Ausgangsdatei sieht dabei bspw. wie folgt aus:
Code:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="XSL.xsl"?>
<data>
<general>
<contact>
<contact_name operator="=">Dummy, User</contact_name>
<date operator="=">2012-01-01</date>
</contact>
</general>
<source>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Dummy, User</Author>
<LastAuthor>Dummy, User</LastAuthor>
<Created>2012-01-01T11:00:00Z</Created>
<Company>n.a.</Company>
<Version>14.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>10035</WindowHeight>
<WindowWidth>18195</WindowWidth>
<WindowTopX>480</WindowTopX>
<WindowTopY>75</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62">
<NumberFormat ss:Format="#,##0.00\ "€""/>
</Style>
<Style ss:ID="s63">
<NumberFormat ss:Format="0"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="6" x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="15">
<Column ss:Index="3" ss:Width="108.75"/>
<Row>
<Cell>
<Data ss:Type="String">ID</Data>
</Cell>
<Cell>
<Data ss:Type="String">Name</Data>
</Cell>
<Cell>
<Data ss:Type="String">Description</Data>
</Cell>
<Cell>
<Data ss:Type="String">Price</Data>
</Cell>
</Row>
<Row>
<Cell ss:StyleID="s63">
<Data ss:Type="Number">1005001</Data>
</Cell>
<Cell>
<Data ss:Type="String">Article 1</Data>
</Cell>
<Cell>
<Data ss:Type="String">Description of article 1</Data>
</Cell>
<Cell ss:StyleID="s62">
<Data ss:Type="Number">10.99</Data>
</Cell>
</Row>
<Row>
<Cell ss:StyleID="s63">
<Data ss:Type="Number">1005002</Data>
</Cell>
<Cell>
<Data ss:Type="String">Article 2</Data>
</Cell>
<Cell>
<Data ss:Type="String">Description of article 2</Data>
</Cell>
<Cell ss:StyleID="s62">
<Data ss:Type="Number">599</Data>
</Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<HorizontalResolution>300</HorizontalResolution>
<VerticalResolution>300</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>9</ActiveRow>
<ActiveCol>6</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet2">
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="15">
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet3">
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="15">
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
</source>
</data>
Kopiert werden soll nun alles unter und einschließlich des Tags
Code:
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
Ich habe über folgende Befehle versucht den entsprechenden Teil des Originals zu kopieren – jedoch ohne Erfolg:
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="data/source">
<xsl:copy-of select="Workbook"/>
</xsl:template>
</xsl:stylesheet>
Meine weiteren "Untersuchungen" haben ergeben, dass die Transformation funktioniert, wenn ich die Namenräume aus dem Workbook-Tag entferne. Könnt ihr mir sagen wie ich meinen XSL-Code anpassen muss, damit die Transformation auch mit den Namenräumen funktioniert?
Im Voraus schon vielen Dank!