Bonjour,
j'aimerais fusionner un nombre N (inconnu) de fichiers XML. J'ai donc décider de créer un fichier XML contenant les chemins :
Mes fichiers XML sont de la forme:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 <?xml version="1.0" standalone="no"?> <files> <path>C:\Documents and Settings\TARGET TRY2.xml</path> <path>C:\Documents and Settings\TARGET TRY.xml</path> </files>
J'ai développer un XSL pour fusionner des fichiers XML en un seul(nouveau). Juste les lignes "Row" sont à conserver et à fusionner le reste ne dois pas bouger.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 <?xml version="1.0" ?> - <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"> ..... </DocumentProperties> + <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> ..... </OfficeDocumentSettings> + <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> ..... </ExcelWorkbook> + <Styles> ..... </Styles> - <Worksheet ss:Name="Service Rates"> - <Names> <NamedRange ss:Name="_FilterDatabase" ss:RefersTo="='Service Rates'!R1C1:R1C7" ss:Hidden="1" /> </Names> - <Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="346" x:FullColumns="1" x:FullRows="1"> <Column ss:AutoFitWidth="0" ss:Width="108.75" /> <Column ss:AutoFitWidth="0" ss:Width="266.25" /> <Column ss:AutoFitWidth="0" ss:Width="72" /> <Column ss:AutoFitWidth="0" ss:Width="56.25" ss:Span="3" /> - <Row> - <Cell ss:StyleID="s21"> <Data ss:Type="String">FAMILY</Data> <NamedCell ss:Name="_FilterDatabase" /> </Cell> - <Cell ss:StyleID="s21"> <Data ss:Type="String">SERVICE</Data> <NamedCell ss:Name="_FilterDatabase" /> </Cell> - <Cell ss:StyleID="s21"> <Data ss:Type="String">LEVEL</Data> <NamedCell ss:Name="_FilterDatabase" /> </Cell> - <Cell ss:StyleID="s21"> <Data ss:Type="String">CODE</Data> <NamedCell ss:Name="_FilterDatabase" /> </Cell> - <Cell ss:StyleID="s21"> <Data ss:Type="String">Rate</Data> <NamedCell ss:Name="_FilterDatabase" /> </Cell> - <Cell ss:StyleID="s21"> <Data ss:Type="String">Currency</Data> <NamedCell ss:Name="_FilterDatabase" /> </Cell> - <Cell ss:StyleID="s21"> <Data ss:Type="String">UOM</Data> <NamedCell ss:Name="_FilterDatabase" /> </Cell> </Row> - <Row> - <Cell ss:StyleID="s22"> <Data ss:Type="String" /> </Cell> - <Cell ss:StyleID="s22"> <Data ss:Type="String">Account Technical</Data> </Cell> - <Cell ss:StyleID="s22"> <Data ss:Type="String">JM</Data> </Cell> - <Cell ss:StyleID="s22"> <Data ss:Type="String">XXJ</Data> </Cell> - <Cell ss:StyleID="s22"> <Data ss:Type="Number">1</Data> </Cell> - <Cell ss:StyleID="s22"> <Data ss:Type="String">EUR</Data> </Cell> - <Cell ss:StyleID="s22"> <Data ss:Type="String">DAY</Data> </Cell> </Row> </Table> - <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> - <Print> <ValidPrinterInfo /> <PaperSizeIndex>9</PaperSizeIndex> <HorizontalResolution>600</HorizontalResolution> <VerticalResolution>0</VerticalResolution> </Print> <TopRowVisible>25</TopRowVisible> - <Panes> - <Pane> <Number>3</Number> <ActiveRow>47</ActiveRow> <ActiveCol>6</ActiveCol> </Pane> </Panes> <ProtectObjects>False</ProtectObjects> <ProtectScenarios>False</ProtectScenarios> </WorksheetOptions> <AutoFilter x:Range="R1C1:R1C7" xmlns="urn:schemas-microsoft-com:office:excel" /> </Worksheet> </Workbook>
Mon Ebauche XSL qui ne fonctionne pas :
Ceux ci ne fonctionne malheureusement pas.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:for-each select="files/path"> <xsl:variable name="PathFile" select="."/> <xsl:variable name="Source" select="document($PathFile)" /> <xsl:for-each select="$Source//Workbook/Worksheet/Table/Row"> <xsl:copy-of select="."/> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Si quelqu'un est capable de m'aider je vous remercie d'avance!
++
Partager