I've a sample xml file such as :
<user_manual document-type="IU" ts-cover="Language Part alt" ts-lang="-" ts-multi="Language Part, Chapter" ts-overview="-" metadata1="9211" brand="Bosch" material-number="dummy_9000727237" vib="RW404960" language-codes="de, en" production-date="2012-12-03" layout-type="-" id="SL9761901">
<embed-language_part id="SL14686180">
<language_part id="ecls_bio_becls_a3_a14686169.SL9761756.7" role="-" lang="de">
<embed-title id="ecls_bio_becls_a3_a14686169.SL9761719.8">
<?ecls-start-embedded-resource resource="ecls_bio_becls_a3_a8581419"?>
<title id="ecls_bio_becls_a3_a8581419.SL8360708.9" role="-">
de Inhaltsverzeichnis
<alt_text>de Gebrauchsanleitung</alt_text>
</title>
<?ecls-end-embedded-resource resource="ecls_bio_becls_a3_a8581419"?>
</embed-title>
<embed-user_manual_part id="ecls_bio_becls_a3_a14686169.SL14686446.10">
<?ecls-start-embedded-resource resource="ecls_bio_becls_a3_a17144756"?>
<user_manual_part id="ecls_bio_becls_a3_a17144756.SL9765760.11" role="-" document-type="IU">
<embed-chapter id="ecls_bio_becls_a3_a17144756.SL9762101.13">
<?ecls-start-embedded-resource resource="ecls_bio_becls_a3_a30660983"?>
<chapter id="ecls_bio_becls_a3_a30660983.SL2300626.14" role="-" toctitle="yes" footrowtitle="no" type="security">
<embed-title_module id="ecls_bio_becls_a3_a30660983.SL2361816.15">
<?ecls-start-embedded-resource resource="ecls_bio_becls_a3_a611713"?>
<title_module id="ecls_bio_becls_a3_a611713.SL873735.16" role="-">
<title id="ecls_bio_becls_a3_a611713.SL873736.17">Sicherheits- und Warnhinweise</title>
</title_module>
<?ecls-end-embedded-resource resource="ecls_bio_becls_a3_a611713"?>
</embed-title_module>
<embed-section id="ecls_bio_becls_a3_a30660983.SL10400094.18">
<?ecls-start-embedded-resource resource="ecls_bio_becls_a3_a11752692"?>
<section id="ecls_bio_becls_a3_a11752692.SL1742298.19" footrowtitle="no" role="-" toctitle="yes">
<?Pub Caret1?>
<embed-title_module id="ecls_bio_becls_a3_a11752692.SL1742291.20">
<?ecls-start-embedded-resource resource="ecls_bio_becls_a3_a16181733"?>
<title_module id="ecls_bio_becls_a3_a16181733.SL984238.21" role="-">
<title id="ecls_bio_becls_a3_a16181733.SL984239.22">Bevor Sie das Gerät in Betrieb nehmen</title>
<para id="ecls_bio_becls_a3_a16181733.SL984240.23">Lesen Sie Gebrauchs- und Montageanleitung aufmerksam durch! Sie enthalten wichtige Informationen über Aufstellen, Gebrauch und Wartung des Gerätes.</para>
<para id="ecls_bio_becls_a3_a16181733.SL984241.24">Der Hersteller haftet nicht, wenn Sie die Hinweise und Warnungen der Gebrauchsanleitung missachten. Bewahren Sie alle Unterlagen für späteren Gebrauch oder für Nachbesitzer auf.</para>
</title_module>
<?ecls-end-embedded-resource resource="ecls_bio_becls_a3_a16181733"?>
</embed-title_module>
</section>
<?Pub *0000000275?>
<?ecls-end-embedded-resource resource="ecls_bio_becls_a3_a11752692"?>
</embed-section>
</chapter>
</embed-chapter>
</embed-user_manual_part>
</language_part>
</embed-language_part>
</user_manual>
I want to use the XQuery language but i am really new to this query language, i couldn't get how it grouping by distinct values, i'm really confused about it.
for $language in fn:doc('name of file')/user_manual/embed-language_part/language_part
return data($language/@lang)
I'm trying this and the output for the language attribute comes but what I'm wanna get is :
<embed-language_part id="SL14686180">
<chapter title:"abc" language(this language must be come fromm the parent language_part's lang attribute):"de">
<title> title(must be come from chapter's title child:"Sicherheits- und Warnhinweise"</title>
<section>
<title> title(must be come from section's title child:"Bevor Sie das Gerät in Betrieb nehmen"</title>
</section>
</chapter>
</embed-language_part>
I know it is so specific but can it be done ? Your help will be appreciated. I can use id attribute as grouping or selecting them as distinct.
No comments:
Post a Comment