|
преобразование xml в xml через xsl
|
|||
---|---|---|---|
#18+
Уважаемая молодежь. Мне 62 и мне интересно работать в xml. Это не фортран, Бейсик, Паскаль, которые я изучал. Поэтому помогите, пожалуйста. Преобразовал один xml в другой через xsl. Затем придется руками удалять лишнее. Но итоговый xml должен иметь иной порядок расположения строк. стартовый файл xml имеет вид: <?xml version="1.0" standalone="no" ?> <?xml-stylesheet type='text/xsl' href='zamena-DOAJ-1d.xsl'?> <journals> <opercard> <operator>ХООНОКУ, ХГАДИ|Ермаков С.С.</operator> <date>2012-02-04_15:26:20</date> <cntArticle>29</cntArticle> <cntnode>1689</cntnode> <cs>-595447878</cs> </opercard> <journal> <journalInfo lang="RUS"> <jrntitle>ФИЗИЧЕСКОЕ ВОСПИТАНИЕ СТУДЕНТОВ</jrntitle> <jrntitlevar>ФВС</jrntitlevar> <publ>Харьковское отделение национального олимпийского комитета Украины, издательство ХГАДИ</publ> <placepubl>Харьков</placepubl> <loc>Украина, 61068, г.Харьков-68, а/я 11135.</loc> </journalInfo> <issue> <issn>2075-5279</issn> <jrncode>20755279</jrncode> <jnumUni>2</jnumUni> <jdateUni>201203</jdateUni> <pages>1-124</pages> <article> <fpageart>3</fpageart> <lpageart>7</lpageart> <authors> <author num="1"> <correspondent>0</correspondent> <individInfo lang="ENG"> <surname>Bakanova</surname> <fname>A.F.</fname> <auemail>alextenn@ukr.net</auemail> <auwork>Kharkov National Aerospace University</auwork> <auinf>Chkalova str. 17, Kharkov, 61070, Ukraine</auinf> </individInfo> </author> <author num="2"> <correspondent>0</correspondent> <individInfo lang="RUS"> <surname>Баканова</surname> <fname>Александра Феликсовна</fname> <auemail>alextenn@ukr.net</auemail> <auwork>Харьковский национальный аэрокосмический университет</auwork> <auinf>ул. Чкалова 17, г. Харьков, 61070, Украина</auinf> </individInfo> </author> <author num="3"> <correspondent>0</correspondent> <individInfo lang="UKR"> <surname>Баканова</surname> <fname>А. Ф.</fname> </individInfo> </author> </authors> <arttitles> <arttitle lang="ENG">To the question of construction of system state standards groundin estimation of physical preparedness of students of higher educational establishments of Ukraine.</arttitle> <arttitle lang="RUS">К ВОПРОСУ ОБОСНОВАНИЯ ПОСТРОЕНИЯ СИСТЕМЫ ГОСУДАРСТВЕННЫХ СТАНДАРТОВ В ОЦЕНКЕ ФИЗИЧЕСКОЙ ПОДГОТОВЛЕННОСТИ СТУДЕНТОВ ВЫСШИХ УЧЕБНЫХ ЗАВЕДЕНИЙ УКРАИНЫ</arttitle> <arttitle lang="UKR">До питання обґрунтування побудови системи державних стандартів в оцінці фізичної підготовленості студентів вищих навчальних закладів України</arttitle> </arttitles> <abstracts> <abstract lang="ENG">Dependence of necessary physical preparedness on the terms of labour activity is examined. Directions of its forming are shown. Dependence of viability and efficiency of labour activity on the level of physical development of students is specified. The levels of physical preparedness and current functional status are confronted. It is marked that in each of the noted constituents basic complication consists of account of individual norm of display of level of development and preparedness. Grounded that the developed standards must execute a control function. It is set that level of physical development, physical preparedness and bodily condition must be utillized for the correction of in-use facilities of physical education.</abstract> <abstract lang="RUS">Рассматривается зависимость необходимой физической подготовленности от условий трудовой деятельности. Показаны направления ее формирования. Указывается зависимость жизнеспособности и эффективности трудовой деятельности от уровня физического развития студентов. Сопоставлены уровни физической подготовленности и текущего функционального состояния. Отмечается, что в каждой из отмеченных составляющих основная сложность состоит в учете индивидуальной нормы проявления уровня развития и подготовленности. Обосновывается, что разрабатываемые стандарты должны выполнять функцию контроля. Установлено, что уровень физического развития, физической подготовленности и физического состояния должен использоваться для коррекции используемых средств физического воспитания.</abstract> <abstract lang="UKR">Розглядається залежність необхідної фізичної підготовленості від умов трудової діяльності. Показані напрями її формування. Указується залежність життєздатності і ефективності трудової діяльності від рівня фізичного розвитку студентів. Зіставлені рівні фізичної підготовленості і поточного функціонального стану. Наголошується, що в кожній з відмічених складових основна складність полягає в обліку індивідуальної норми прояву рівня розвитку і підготовленості. Обґрунтовується, що стандарти повинні виконувати функцію контролю. Встановлено, що рівень фізичного розвитку, фізичної підготовленості і фізичного стану повинен використовуватися для корекції використовуваних засобів фізичного виховання.</abstract> </abstracts> <arttype>RAR</arttype> <text lang="RUS" arttype="RAR">Физическая подготовленность населения отражает одну из основопологающих сторон уровня ее жизнеспособности. Ее оценку можно осуществить по определенным тестам, которые формируются условиями, предъявляемыми трудовой деятельности требует различного уровня физической подготовленности лица, выполняющего соответствующей вид деятельности.................. предметом наших дальнейших исследований</text> <keywords> <kwdGroup lang="ENG"> <keyword>standards</keyword> <keyword>tests</keyword> <keyword>estimations</keyword> <keyword>development</keyword> <keyword>physical</keyword> </kwdGroup> <kwdGroup lang="RUS"> <keyword>стандарты</keyword> <keyword>тесты</keyword> <keyword>оценки</keyword> <keyword>развитие</keyword> <keyword>физическая</keyword> </kwdGroup> <kwdGroup lang="UKR"> <keyword>стандарти</keyword> <keyword>тести</keyword> <keyword>оцінки</keyword> <keyword>розвиток</keyword> <keyword>фізична</keyword> </kwdGroup> </keywords> <biblist> <blistpart>Лакин Г. Ф. Биометрия. М. Высшая школа. 1973, с. 44-54. </blistpart> <blistpart>Корольков А. А., Петленко В. П. Философские проблемы теории нормы в биологии и медицине. - М.: Медицина, 1997. - 391 с. </blistpart> <blistpart>Панин Л. Е. Изменчивое постоянство, Химия и жизнь, №1, 1984, с. 42-46. </blistpart> <blistpart>Кетле Л. А. Ж. О человеке и развитии его способностей или опыт социальной физики, Санкт - Петербург 1911, 241 с. </blistpart> <blistpart>Самсонкин В. Н., Друзь В. А., Федорович Е. С. Моделирование в самоорганизующихся системах. Донецк, Заславский, 2010, 104 с. </blistpart> <blistpart>Пятисотская С. С. Проблема индивидуального подхода подготовки в спортивных единоборствах (каратэ) Слобожанский науково-спортивний вiсник: Видання Харкiвської державної академії фізичної культури.-Вип.3.-Харків:ХДАФК, 2009.- с. 168-171. </blistpart> <blistpart>Ван Ли Хуа. Организация управления внедрением государственных стандартов физической подготовленности студентов ВУЗ КНР. Дисс. канд.наук по физ.восп. и спорту, Харьков. 2011, 206 c. </blistpart> <blistpart>Харрисон Дж., Уайнер Дж., Танер Дж., Барникот Н. Биология человека часть 4. Рост и конституция человека. М. Мир, 1968, с. 247-331. </blistpart> <blistpart>Плахов В. Д. Социальные нормы: философские основания общей теории. М, Мысль, 1985, 253 с. </blistpart> <blistpart>Раубер А. Учебник анатомии человека. Санкт-Петербург, 1902., том I, с. 177-211. </blistpart> </biblist> <fpdf>12bafeeu.pdf</fpdf> </article> <article> ............... </article> </issue> </journal> </journals> xsl файл zamena-DOAJ-1d.xsl имеет вид: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="xml" indent="yes"/> <!-- начало удаляем ненужные теги --> <xsl:template match="//opercard" /> <xsl:template match="//journalInfo[@lang='RUS']" /> <xsl:template match="//issn" /> <xsl:template match="//jrncode" /> <xsl:template match="//jnumUni" /> <xsl:template match="//jdateUni" /> <xsl:template match="//pages" /> <xsl:template match="//correspondent" /> <xsl:template match="//arttype" /> <xsl:template match="//text" /> <xsl:template match="//arttitle[@lang='RUS']" /> <xsl:template match="//arttitle[@lang='UKR']" /> <xsl:template match="//abstract[@lang='RUS']" /> <xsl:template match="//abstract[@lang='UKR']" /> <xsl:template match="//kwdGroup[@lang='RUS']" /> <xsl:template match="//kwdGroup[@lang='UKR']" /> <xsl:template match="//kwdGroup[@lang='UKR']" /> <xsl:template match="//individInfo[@lang='RUS']" /> <xsl:template match="//individInfo[@lang='UKR']" /> <xsl:template match="//biblist" /> <xsl:template match="//auinf" /> <!-- конец удаляем ненужные теги --> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <!-- заменяем теги для DOAJ --> <xsl:template match="issue"> <xsl:element name="records"> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <!-- начало пример как вставить после record нужные строки --> <xsl:template match="article"> <xsl:element name="record"> <language>rus</language> <publisher>Kharkov Regional Branch of the National Olympic Committee of Ukraine </publisher> <journalTitle> Fiziceskoe vospitanie studentov</journalTitle> <issn>20755279</issn> <publicationDate>2012-04-29</publicationDate> <volume>2</volume> <documentType>article</documentType> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <!-- конец пример как вставить после record нужные строки --> <xsl:template match="fpageart"> <xsl:element name="startPage"> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <xsl:template match="lpageart"> <xsl:element name="endPage"> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <xsl:template match="kwdGroup"> <xsl:element name="keywords"> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <xsl:template match="auemail"> <xsl:element name="email"> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <xsl:template match="auwork"> <xsl:element name="affiliationName"> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <xsl:template match="fpdf"> <xsl:element name="fullTextUrl"> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <xsl:template match="arttitle"> <xsl:element name="title"> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <!-- начало пример как вставить нужные строки --> <xsl:template match="arttitles"> <xsl:element name="arttitles"> <affiliationsList> <affiliationName affiliationId="1">University</affiliationName> </affiliationsList> <xsl:apply-templates select="@* | node()" /> </xsl:element> </xsl:template> <!-- начало преобразование данные об авторе --> <xsl:template match="@num"> <affiliationId> <xsl:value-of select="."/> </affiliationId> </xsl:template> <xsl:template match="surname"> <name> <xsl:apply-templates/> <xsl:apply-templates select="following-sibling::fname" mode="name"/> </name> </xsl:template> <xsl:template match="fname"/> <xsl:template match="fname" mode="name"> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:template> <!-- конец преобразование данные об авторе --> </xsl:stylesheet> привожу полученный файл: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type='text/xsl' href='zamena-DOAJ-1d.xsl'?> <journals> <journal> <records> <record> <language>rus</language> <publisher>Kharkov Regional Branch of the National Olympic Committee of Ukraine </publisher> <journalTitle> Fiziceskoe vospitanie studentov</journalTitle> <issn>20755279</issn> <publicationDate>2012-04-29</publicationDate> <volume>2</volume> <documentType>article</documentType> <startPage>3</startPage> <endPage>7</endPage> <authors> <author> <affiliationId>1</affiliationId> <individInfo lang="ENG"> <name>Bakanova A.F.</name> <email>alextenn@ukr.net</email> <affiliationName>Kharkov National Aerospace University</affiliationName> </individInfo> </author> <author> <affiliationId>2</affiliationId> </author> <author> <affiliationId>3</affiliationId> </author> </authors> <arttitles> <affiliationsList> <affiliationName affiliationId="1">University</affiliationName> </affiliationsList> <title lang="ENG">To the question of construction of system state standards groundin estimation of physical preparedness of students of higher educational establishments of Ukraine.</title> </arttitles> <abstracts> <abstract lang="ENG">Dependence of necessary physical preparedness on the terms of labour activity is examined. Directions of its forming are shown. Dependence of viability and efficiency of labour activity on the level of physical development of students is specified. The levels of physical preparedness and current functional status are confronted. It is marked that in each of the noted constituents basic complication consists of account of individual norm of display of level of development and preparedness. Grounded that the developed standards must execute a control function. It is set that level of physical development, physical preparedness and bodily condition must be utillized for the correction of in-use facilities of physical education.</abstract> </abstracts> <keywords> <keywords lang="ENG"> <keyword>standards</keyword> <keyword>tests</keyword> <keyword>estimations</keyword> <keyword>development</keyword> <keyword>physical</keyword> </keywords> </keywords> <fullTextUrl>12bafeeu.pdf</fullTextUrl> </record> <record><language>rus</language><publisher>Kharkov Regional Branch of the National Olympic Committee of Ukraine </publisher><journalTitle> Fiziceskoe vospitanie studentov</journalTitle><issn>20755279</issn><publicationDate>2012-04-29</publicationDate><volume>2</volume><documentType>article</documentType> ............... </record> </records> </journal> </journals> Однако остается много лишнего: Если удалить это лишнее: ПРИВОЖУ ЛИШНЕЕ, которое планирую удалить руками: 1. <journals> <journal> </journal> </journals> 2. <abstracts> </abstracts> 3. <keywords> </keywords> при этом оставить <keywords lang="ENG"> </keywords> 4. <individInfo lang="ENG"> </individInfo> 5. <author> <affiliationId>2</affiliationId> </author> таких повторений в файле от номера 1 до номера 12 Затем провести замены: 1. lang="ENG" на language="eng" 2. <fullTextUrl> на <fullTextUrl format="pdf"> http://nbuv.gov.ua/portal/Soc_Gum/PhVSTS/2012_2/ Далее изменить и переместить в <affiliationsList>: например <affiliationName>Kharkov National Aerospace University</affiliationName> в <affiliationName affiliationId="1">University</affiliationName> таким образом, чтобы получилось: <affiliationName affiliationId="1">Kharkov National Aerospace University</affiliationName> таких номеров может быть 4 и более (по количеству вузов в статье). В ИТОГЕ РАБОТЫ РУКАМИ получим конечный файл, у которого порядок расположения строк отличается от запланированного. Хотелось бы получить конечный файл такого вида: <?xml version="1.0" encoding="UTF-8"?> <records> <record> <language>rus</language> <publisher>Kharkov Regional Branch of the National Olympic Committee of Ukraine </publisher> <journalTitle> Fiziceskoe vospitanie studentov</journalTitle> <issn>20755279</issn> <publicationDate>2012-04-29</publicationDate> <volume>2</volume> <startPage>3</startPage> <endPage>7</endPage> <documentType>article</documentType> <title language="eng">To the question of construction of system state standards groundin estimation of physical preparedness of students of higher educational establishments of Ukraine.</title> <authors> <author> <name>Bakanova A.F.</name> <email>alextenn@ukr.net</email> <affiliationId>1</affiliationId> </author> </authors> <affiliationsList> <affiliationName affiliationId="1">Kharkov National Aerospace University</affiliationName> </affiliationsList> <abstract language="eng">Dependence of necessary physical preparedness on the terms of labour activity is examined. Directions of its forming are shown. Dependence of viability and efficiency of labour activity on the level of physical development of students is specified. The levels of physical preparedness and current functional status are confronted. It is marked that in each of the noted constituents basic complication consists of account of individual norm of display of level of development and preparedness. Grounded that the developed standards must execute a control function. It is set that level of physical development, physical preparedness and bodily condition must be utillized for the correction of in-use facilities of physical education.</abstract> <fullTextUrl format="pdf"> http://nbuv.gov.ua/portal/Soc_Gum/PhVSTS/2012_2/12bafeeu.pdf</fullTextUrl> <keywords language="eng"> <keyword>standards</keyword> <keyword>tests</keyword> <keyword>estimations</keyword> <keyword>development</keyword> <keyword>physical</keyword> </keywords> </record> <record> .................. </record> </records> С уважением, Ермаков Сергей Сидорович, г. Харьков, ХГАДИ 706-21-03. ... |
|||
:
Нравится:
Не нравится:
|
|||
02.05.2012, 11:38 |
|
|
start [/forum/topic.php?fid=14&fpage=23&tid=1332728]: |
0ms |
get settings: |
10ms |
get forum list: |
13ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
37ms |
get topic data: |
11ms |
get forum data: |
2ms |
get page messages: |
36ms |
get tp. blocked users: |
1ms |
others: | 268ms |
total: | 384ms |
0 / 0 |