Één XSL voor meerdere XML's

Pagina: 1
Acties:

  • DPhoenix
  • Registratie: Februari 2001
  • Laatst online: 09-09 22:47
Ik heb meerdere XML's die allemaal dezelfde type nodes gebruiken. De XML bevatten nodes voor een Dialogbox (schermpje).

Deze schermpjes zijn gemaakt in een applicatie die er XML's van genereerde. Allemaal hebben ze dus dezelfde nodes.

Is het mogelijk om voor al deze XML's (verschillende schermpjes) om te zetten naar HTML gebruik makend van één enkele XSL?

AULXJMHR


Verwijderd

post 'ns een voorbeeldje van zo'n stukje xml-code

  • didio
  • Registratie: Maart 2001
  • Laatst online: 01-04 09:19

didio

didio.nl

volgens mij wel.. als ze er ook allemaal het zelfde uit mogen komen te zien in html.

weinig tot niks..


  • DPhoenix
  • Registratie: Februari 2001
  • Laatst online: 09-09 22:47
Op vrijdag 18 januari 2002 12:30 schreef Mas*Mind het volgende:
post 'ns een voorbeeldje van zo'n stukje xml-code
code:
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<DIALOGS>
   <DIALOG>
    <name>EPDGBS</name>
    <POSITION>
      <x>0</x>
      <y>0</y>
      <w>282</w>
      <h>181</h>
      <units>Dialog</units>
    </POSITION>
    <STYLES>
       <style>Caption</style>
       <style>SystemMenu</style>
       <style>MinimizeBox</style>
       <style>MaximizeBox</style>
       <style>Resizable</style>
     <style>Absolute</style>
    </STYLES>
    <caption>EPD Gebruikers</caption>
    <FONT>
       <name>MS Sans Serif</name>
       <size>8</size>
    </FONT>
    <!--       <icon> EPDGB    </icon> -->
    <CONTROLS>
       <CONTROL>
        <type>Borshade</type>
        <STYLES>
           <style>Visible</style>
           <style>Group</style>
           <style>Border</style>
           <style>Etched</style>
        </STYLES>
        <POSITION>
           <x>5</x>
           <y>1</y>
           <w>272</w>
           <h>176</h>
           <units>Dialog</units>
        </POSITION>
        <SCALING>
           <scalable>XY</scalable>
           <anchor>TopLeft</anchor>
        </SCALING>
       </CONTROL>
        <CONTROL>
           <caption>EPD Gebruikers</caption>
           <type>Static</type>
           <STYLES>
            <style>Visible</style>
           </STYLES>
           <POSITION>
            <x>109</x>
            <y>1</y>
            <w>65</w>
            <h>9</h>
            <units>Dialog</units>
           </POSITION>
           <COLOR>
            <foreground>white</foreground>
            <background>blue</background>
           </COLOR>
           <FORMAT>
            <alignment>Center</alignment>
           </FORMAT>
           <SCALING>
            <scalable>X</scalable>
            <anchor>TopLeft</anchor>
           </SCALING>
        </CONTROL>
       <CONTROL>
        <type>BorShade</type>
        <STYLES>
           <style>Visible</style>
           <style>Group</style>
           <style>Border</style>
           <style>Etched</style>
        </STYLES>
        <POSITION>
           <x>10</x>
           <y>14</y>
           <w>260</w>
           <h>159,5</h>
           <units>Dialog</units>
        </POSITION>
        <SCALING>
           <scalable>XY</scalable>
           <anchor>TopLeft</anchor>
        </SCALING>
       </CONTROL>
    <CONTROL>
       <caption>Usr mnem,Usr naam,Epdnr,Epdmnem</caption>
       <name>R01</name>
       <type>PhoenixBrws</type>
       <rows>30</rows>
       <STYLES>
        <style>Visible</style>
        <style>Tabstop</style>
        <style>AutoStart</style>
       </STYLES>
       <POSITION>
        <x>16</x>
        <y>24</y>
        <w>248</w>
        <h>108</h>
        <units>Dialog</units>
       </POSITION>
       <COLOR>
       </COLOR>
       <FORMAT>
        <transport>102</transport>
       </FORMAT>
       <VALIDATION_TYPES>
       </VALIDATION_TYPES>
       <PROCESSINGFLAGS>
        <flag>NoBrowse</flag>
       </PROCESSINGFLAGS>
       <CONTROLS>
        <CONTROL>
           <caption>Usr mnem</caption>
           <type>PhoenixEdit</type>
           <format>
            <transport>8</transport>
            <length>10</length>
           </format>
        </CONTROL>
        <CONTROL>
           <caption>Usr naam</caption>
           <type>PhoenixEdit</type>
           <format>
            <transport>20</transport>
            <length>22</length>
           </format>
        </CONTROL>
        <CONTROL>
           <caption>Epdnr</caption>
           <type>PhoenixEdit</type>
           <format>
            <transport>2</transport>
            <length>4</length>
           </format>
        </CONTROL>
        <CONTROL>
           <caption>Epdmnem</caption>
           <type>PhoenixEdit</type>
           <format>
            <transport>8</transport>
            <length>10</length>
           </format>
        </CONTROL>
       </CONTROLS>
    </CONTROL>
    <CONTROL>
       <caption>Toevoegen</caption>
       <name>F02</name>
       <type>button</type>
       <index>0</index>
       <STYLES>
        <style>Visible</style>
        <style>Tabstop</style>
        <style>AutoExit</style>
       </STYLES>
       <POSITION>
        <x>156</x>
        <y>144</y>
        <w>40</w>
        <h>14</h>
        <units>Dialog</units>
       </POSITION>
       <COLOR>
       </COLOR>
       <FORMAT>
       </FORMAT>
       <VALIDATION_TYPES>
       </VALIDATION_TYPES>
       <PROCESSINGFLAGS>
        <flag>NoBrowse</flag>
       </PROCESSINGFLAGS>
    </CONTROL>
    <CONTROL>
       <caption>Verwijderen</caption>
       <name>F04</name>
       <type>button</type>
       <index>0</index>
       <STYLES>
        <style>Visible</style>
        <style>Tabstop</style>
        <style>AutoExit</style>
       </STYLES>
       <POSITION>
        <x>220</x>
        <y>144</y>
        <w>40</w>
        <h>14</h>
        <units>Dialog</units>
       </POSITION>
       <COLOR>
       </COLOR>
       <FORMAT>
       </FORMAT>
       <VALIDATION_TYPES>
       </VALIDATION_TYPES>
       <PROCESSINGFLAGS>
        <flag>NoBrowse</flag>
       </PROCESSINGFLAGS>
    </CONTROL>
    <CONTROL>
       <caption>Sluiten</caption>
       <name>Close</name>
       <type>button</type>
       <id>Clo</id>
       <STYLES>
        <style>Visible</style>
        <style>Tabstop</style>
       </STYLES>
       <POSITION>
        <x>281</x>
        <y>5</y>
        <w>40</w>
        <h>14</h>
        <units>Dialog</units>
       </POSITION>
       <COLOR>
       </COLOR>
       <PROCESSINGFLAGS>
        <flag>OnAutoStart</flag>
       </PROCESSINGFLAGS>
       <FORMAT>
       </FORMAT>
       <tooltip>Druk op deze knop,\nom de dialoog te sluiten,\nzonder te verwerken</tooltip>
    </CONTROL>
    <CONTROL>
       <caption>Help</caption>
       <name>Help</name>
       <type>button</type>
       <id>Hlp</id>
       <STYLES>
        <style>Visible</style>
        <style>Tabstop</style>
       </STYLES>
       <POSITION>
        <x>281</x>
        <y>163</y>
        <w>40</w>
        <h>14</h>
        <units>Dialog</units>
       </POSITION>
       <COLOR>
       </COLOR>
       <PROCESSINGFLAGS>
        <flag>OnAutoStart</flag>
       </PROCESSINGFLAGS>
       <FORMAT>
       </FORMAT>
       <tooltip>Druk op deze knop,\nom informatie te krijgen\nover deze dialoog</tooltip>
    </CONTROL>
    </CONTROLS>
    <TOOLBAR>
       <CONTROL>
        <name>Close</name>
        <icon>K_EXIT</icon>
        <type>Button</type>
       </CONTROL>
       <CONTROL>
        <type>     Separator       </type>
        <POSITION>
           <w>4</w>
           <units> Dialog       </units>
        </POSITION>
       </CONTROL>
       <CONTROL>
        <name>Help</name>
        <icon>K_HELPX</icon>
        <type>Button</type>
       </CONTROL>
    </TOOLBAR>
   </DIALOG>
</DIALOGS>
Op vrijdag 18 januari 2002 12:33 schreef didio het volgende:
volgens mij wel.. als ze er ook allemaal het zelfde uit mogen komen te zien in html.
De schermen zien er niet allemaal exact hetzelfde uit natuurlijk, maar gebruiken wel allemaal dezelfde nodes

AULXJMHR


  • mbravenboer
  • Registratie: Januari 2000
  • Laatst online: 06-11-2025
Nee, dit is niet mogelijk met XSLT 1.0. In XSLT 1.0 is er namelijk maar 1 result tree. Je kunt uiteraard als je resultaat XML is wel meerdere XHTML pagina's opleveren in 1 XML document. Deze moet je dan later uit elkaar halen.

Het is pas in in XSLT 2.0 mogelijk om meerdere result trees op te leveren. Als je het leuk vind kan je eens kijken in de Working Draft hoe dit er uit gaat zien. Het is echter nog nergens geimplementeerd voor zover ik weet. Je kunt hiermee bijvoorbeeld een frameset pagina en de content van de frames in 1 keer opleveren. Uiteraard is het voor veel meer toepassingen interessant :) .

Blog, Stratego/XT: Program Transformation, SDF: Syntax Definition, Nix: Software Deployment


  • mbravenboer
  • Registratie: Januari 2000
  • Laatst online: 06-11-2025
Zie trouwens ook dit topic:
[topic=374272/1/25]

Je kunt je XSL stylesheet trouwens ook parameterizeren en met verschillende parameters uitvoeren. Zo kan je ook verschillende resultaten maken met dezelfde stylesheet.

Blog, Stratego/XT: Program Transformation, SDF: Syntax Definition, Nix: Software Deployment


  • DPhoenix
  • Registratie: Februari 2001
  • Laatst online: 09-09 22:47
Op vrijdag 18 januari 2002 12:44 schreef mbravenboer het volgende:
Nee, dit is niet mogelijk met XSLT 1.0. In XSLT 1.0 is er namelijk maar 1 result tree. Je kunt uiteraard als je resultaat XML is wel meerdere XHTML pagina's opleveren in 1 XML document. Deze moet je dan later uit elkaar halen.
Dus als ik je goed begrijp moet ik voor iedere XML een eigen XSL maken?

AULXJMHR


  • DPhoenix
  • Registratie: Februari 2001
  • Laatst online: 09-09 22:47
De XML's die ik heb, hebben allemaal dezelfde node-trees gezien het allemaal schermpjes (dialogboxes) zijn, echter elk schermpje ziet er anders uit. Maar voor de rest zijn de node-trees hetzelfde.

Dan zou het toch wel mogelijk moeten zijn, als alle XML's eenzelfde soort node-tree gebruiken, om maar één XSL voor al die XML's te gebruiken?

Want wat ik begrijp uit de XSLT 2.0 Workdraft, is het in die versie mogelijk om XML's met verschillende soorten node-trees uit te spugen. >

http://www.w3.org/TR/xslt20/#section-Major-Features

AULXJMHR


Verwijderd

ik denk dat dutchphoenix zich afvraagt of je 1 generieke stylesheet kan bouwen die elk willekeurig schermpje kan omzetten naar html. (toch?)

Verwijderd

dat kan idd, je xsl stylesheet zal er in structuur ongeveer zo uitzien:
code:
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
<xsl:template match="dialogs">
</xsl:template>

<xsl:template match="dialog">
</xsl:template>

<xsl:template match="controls">
</xsl:template>

<xsl:template match="toolbar">
</xsl:template>

<xsl:template match="control[@type='button']">
</xsl:template>

<xsl:template match="control[@type='borShade']">
</xsl:template>

<xsl:template match="control[@type='static']">
</xsl:template>

<xsl:template match="control[@type='PhoenixBrws']">
</xsl:template>

<xsl:template match="control[@type='PhoenixEdit']">
</xsl:template>

<xsl:template match="control[@type='Separator']">
</xsl:template>

etc..etc... de rest moet je zelf maar uitvogelen

  • DPhoenix
  • Registratie: Februari 2001
  • Laatst online: 09-09 22:47
Op vrijdag 18 januari 2002 14:07 schreef Mas*Mind het volgende:
ik denk dat dutchphoenix zich afvraagt of je 1 generieke stylesheet kan bouwen die elk willekeurig schermpje kan omzetten naar html. (toch?)
Precies, en elk schermpje gebruikt dezelfde nodes. In dit geval oa. dialogs, dialog, name, postion, styles, caption etc.

AULXJMHR


  • mbravenboer
  • Registratie: Januari 2000
  • Laatst online: 06-11-2025
Tuurlijk kan dat :) . Je kunt makkelijk een generieke stylesheet maken. Ben je er al mee bezig geweest? Als je het gaat proberen ontdek vanzelf dat het makkelijk is, of als je dat niet ontdekt klop je hier aan als je vast loopt ;) .

Ik had eerst begrepen dat je in 1 toepassing van een stylesheet meerdere XML documenten op wilt leveren. Dat is dus niet mogelijk met XSLT 1.0, wel met 2.0.

Blog, Stratego/XT: Program Transformation, SDF: Syntax Definition, Nix: Software Deployment


Verwijderd

Op vrijdag 18 januari 2002 16:28 schreef mbravenboer het volgende:
Ik had eerst begrepen dat je in 1 toepassing van een stylesheet meerdere XML documenten op wilt leveren. Dat is dus niet mogelijk met XSLT 1.0, wel met 2.0.
Zou je hier een voorbeeldje van kunnen geven of een linkje dat het eea verduidelijkt? Ik heb er op w3c naar gekeken, maar kon er niet veel wijs uit worden...

  • mbravenboer
  • Registratie: Januari 2000
  • Laatst online: 06-11-2025
Hier staat wel een voorbeeld over frames, maar of dat nu echt de ultieme toepassing is, is een andere vraag...

http://www.w3.org/TR/xslt20/#secondary-result-trees

Het idee is simpel: als je een xsl:result-document gebruikt wordt de content daarvan in een nieuw document gestopt. Je kunt via de uris van de xsl:result-documents de resultaten uit de XSLT processor halen.

Blog, Stratego/XT: Program Transformation, SDF: Syntax Definition, Nix: Software Deployment

Pagina: 1