PDA

View Full Version : XSL question



смешно
09-24-2012, 09:00 AM
никогда не работал с XSL, подскажите простое решение для такой простой задачки, мозг чего-то тормозит. :)


skillID is cross reference between data.

basically I have one XML file like:

<file>
<employee>
<name>Employee 1</name>
<skillID>100</skillID>
</employee>
<employee>
<name>Employee 2</name>
<skillID>300</skillID>
</employee>
<employee>
<name>Employee 3</name>
<skillID>100</skillID>
</employee>
......

<skills>
<skillID>100</skillID>
<SKILL>work involved in serving food and beverages and preparing simple food</SKILL>
<ABILITY>waiting on tables, portioning, assembling, recording data, assisting, transporting, communicating, cleaning</ABILITY>
</skills>
<skills>
<skillID>300</skillID>
<SKILL>perform laboring duties that involve little or no specialized skill or prior work experience</SKILL>
<ABILITY>loading, moving, mowing, trimming, washing, clearing, digging, landscaping</ABILITY>
</skills>
......

</file>


Whould like to format it to XML file like:


<file>
<employee>
<name>Employee 1</name>
<SKILL>work involved in serving food and beverages and preparing simple food</SKILL>
<ABILITY>waiting on tables, portioning, assembling, recording data, assisting, transporting, communicating, cleaning</ABILITY>
</employee>
<employee>
<name>Employee 2</name>
<SKILL>perform laboring duties that involve little or no specialized skill or prior work experience</SKILL>
<ABILITY>loading, moving, mowing, trimming, washing, clearing, digging, landscaping</ABILITY>
</employee>
<employee>
<name>Employee 3</name>
<SKILL>work involved in serving food and beverages and preparing simple food</SKILL>
<ABILITY>waiting on tables, portioning, assembling, recording data, assisting, transporting, communicating, cleaning</ABILITY>
</employee>

.....


</file>

смешно
09-24-2012, 01:01 PM
никто не может? ЛОЛ

crazy-mike
09-24-2012, 01:41 PM
никто не может? ЛОЛ
У меня где-то в книжке об XSLT есть - но я этим совсем не пользуюсь. У меня навязчивая идея - на всех веб-страничках только css и javascript.
Там для XML в твоём пример ведь и разметка немного неудобная. Аттрибуты тегов вообще не используются почему-то.

смешно
09-24-2012, 08:28 PM
ладно, сделал уже сам. всем спасибо.