Transformations XSLT



Documents pareils
«Rénovation des curricula de l enseignement supérieur - Kazakhstan»

Instructions Mozilla Thunderbird Page 1

Les Portfolios et Moodle Petit inventaire

À l'approche du festival MUTEK 2015, nous vous contactons pour vous faire part de quelques informations importantes.

RULE 5 - SERVICE OF DOCUMENTS RÈGLE 5 SIGNIFICATION DE DOCUMENTS. Rule 5 / Règle 5

Le passé composé. C'est le passé! Tout ça c'est du passé! That's the past! All that's in the past!

Nouveautés printemps 2013

DIPLOME NATIONAL DU BREVET TOUTES SERIES

INSTITUT MARITIME DE PREVENTION. For improvement in health and security at work. Created in 1992 Under the aegis of State and the ENIM

Frequently Asked Questions

AMENDMENT TO BILL 32 AMENDEMENT AU PROJET DE LOI 32

Data issues in species monitoring: where are the traps?

Faculté de Génie Chaire industrielle en infrastructures de communication. La technologie XML. Wajdi Elleuch

<?xml version="1.0" encoding="iso " standalone="yes"?>

Server-side XML. PAS FINI... mais ok pour un début. Originaux. Auteurs et version. Prérequis: Java de base, servlets, GUI et XML

that the child(ren) was/were in need of protection under Part III of the Child and Family Services Act, and the court made an order on

Consultants en coûts - Cost Consultants

Master d Informatique Corrigé du partiel novembre 2010

Contents Windows

PANKA. PORTFOLIO Karina Pannhasith. Karina Pannhasith. URBANIA Ipad Magazine School Project 2012 Photoshop Illustrator Dreamweaver Hype - HTML5

Miroir de presse. International Recruitment Forum 9-10 mars 2015

PROJET DE LOI. An Act to Amend the Employment Standards Act. Loi modifiant la Loi sur les normes d emploi

Filed December 22, 2000

Exemple PLS avec SAS

Tammy: Something exceptional happened today. I met somebody legendary. Tex: Qui as-tu rencontré? Tex: Who did you meet?

Introduction à la Sécurité Informatique

Credit Note and Debit Note Information (GST/ HST) Regulations

Tutoriel de formation SurveyMonkey

POLICY: FREE MILK PROGRAM CODE: CS-4

Utiliser une WebCam. Micro-ordinateurs, informations, idées, trucs et astuces

PROFESSIONNELS / professionals FICHE D INSCRIPTION / registration form

PREVENTION OF MSL FOR VDT USERS IN A LARGE SERVICE ORIENTED BUSINESS

1.The pronouns me, te, nous, and vous are object pronouns.

The impacts of m-payment on financial services Novembre 2011

Comprendre l impact de l utilisation des réseaux sociaux en entreprise SYNTHESE DES RESULTATS : EUROPE ET FRANCE

CONVENTION DE STAGE TYPE STANDART TRAINING CONTRACT

Stéphane Lefebvre. CAE s Chief Financial Officer. CAE announces Government of Canada participation in Project Innovate.

FICHE D INSCRIPTION ET FICHE D INFORMATION MEDICALE POUR ELEVES LYCEE FRANÇAIS INTERNATIONAL

PHOTO ROYAUME DE BELGIQUE /KINDOM OF BELGIUM /KONINKRIJK BELGIE. Données personnelles / personal data

Conseil / Council. Personnes ressources / Resource persons. Directeur général / greffier/ trésorier Greffière adjointe Marielle Dupuis Deputy-Clerk

Once the installation is complete, you can delete the temporary Zip files..

APPENDIX 6 BONUS RING FORMAT

BILL 203 PROJET DE LOI 203

Innovation in Home Insurance: What Services are to be Developed and for what Trade Network?

NOTICE INSTALLATION. ARCHANGE WebDAV Office N&B/Couleur KONICA MINOLTA BUSINESS SOLUTIONS FRANCE

Stratégie DataCenters Société Générale Enjeux, objectifs et rôle d un partenaire comme Data4

Bill 12 Projet de loi 12

GAME CONTENTS CONTENU DU JEU OBJECT OF THE GAME BUT DU JEU

La saisonnalité. Cas de Marrakech

AU PAIR IN FRANCE. Our host families are based everywhere is France

Lesson Plan Physical Descriptions. belle vieille grande petite grosse laide mignonne jolie. beau vieux grand petit gros laid mignon

Cloud Computing: de la technologie à l usage final. Patrick CRASSON Oracle Thomas RULMONT WDC/CloudSphere Thibault van der Auwermeulen Expopolis

How to Login to Career Page

IDENTITÉ DE L ÉTUDIANT / APPLICANT INFORMATION

EN UNE PAGE PLAN STRATÉGIQUE

RISK-BASED TRANSPORTATION PLANNING PRACTICE: OVERALL METIIODOLOGY AND A CASE EXAMPLE"' RESUME

Railway Operating Certificate Regulations. Règlement sur les certificats d exploitation de chemin de fer CODIFICATION CONSOLIDATION

PARIS ROISSY CHARLES DE GAULLE

XML par la pratique Bases indispensables, concepts et cas pratiques (3ième édition)

1 ère Université WEB. Courbevoie Samedi 21 octobre Votre site interactif sur internet.

Algorithmes de recommandation, Cours Master 2, février 2011

Fiche L. Les temps et aspects du présent. - une vérité générale. Ex : Water boils at 100'C. - une caractéristique. Ex : Jenny is tall and blonde.

Dates and deadlines

Garage Door Monitor Model 829LM

L ESPACE À TRAVERS LE REGARD DES FEMMES. European Economic and Social Committee Comité économique et social européen

Input Tax Credit Information (GST/HST) Regulations

ASSEMBLY INSTRUCTIONS DIRECTIVES POUR L'ASSEMBLAGE ombre pendant lamp lampe suspendue à tons dégradés, chocolat

If you understand the roles nouns (and their accompanying baggage) play in a sentence...

accidents and repairs:

Notice Technique / Technical Manual

SCHOLARSHIP ANSTO FRENCH EMBASSY (SAFE) PROGRAM APPLICATION FORM

INTERNATIONAL CRIMINAL COURT. Article 98 TREATIES AND OTHER INTERNATIONAL ACTS SERIES Agreement between the UNITED STATES OF AMERICA and GABON

part de mon expérience.

VTP. LAN Switching and Wireless Chapitre 4

THE LAW SOCIETY OF UPPER CANADA BY-LAW 19 [HANDLING OF MONEY AND OTHER PROPERTY] MOTION TO BE MOVED AT THE MEETING OF CONVOCATION ON JANUARY 24, 2002

Examen Final. Indications

Bureau 17 septembre 2013 à 18h00 GSD 211. Board September 17, 2013 at 6:00 PM GSD 211 ITEM. Appel à l ordre : 18h10. 1 Call to Order: 6:10 pm

HELLO KIDS. Learn English with Charlie, Lily, Max & Fiona GUIDE PÉDAGOGIQUE

Name Use (Affiliates of Banks or Bank Holding Companies) Regulations

Plan Vert de l industrie touristique montréalaise 21 février 2014

Plan du cours : Zippers. Des fonctions sur les listes avec position. Des fonctions sur les listes avec position

Consultation Report / Rapport de consultation REGDOC-2.3.3, Periodic Safety Reviews / Bilans périodiques de la sûreté

Je demande à bénéficier d un Pass Sport Culture 2015 qui me donnera accès aux activités présentées pour le(s) mois de : NOM :... Prénom : Né(e) le :

ETABLISSEMENT D ENSEIGNEMENT OU ORGANISME DE FORMATION / UNIVERSITY OR COLLEGE:

McGILL UNIVERSITY MARTLET CLASSIC UNIVERSITE McGILL CLASSIQUE MARTLET

Resident Canadian (Insurance Companies) Regulations. Règlement sur les résidents canadiens (sociétés d assurances) CONSOLIDATION CODIFICATION

RICHEL SERRES DE FRANCE PAR_ _02432_ALT DATE: 03/02/2012

Compléter le formulaire «Demande de participation» et l envoyer aux bureaux de SGC* à l adresse suivante :

Restoring people s trust in their government by making governments more open and transparent

Production de documents avec XSLT. Production de documents p.1/??

WEST AFRICA INTERNET GOVERNACE FIFTH GLOBAL INTERNET GOVERNACE FORUM. 14th to 17th Septembre 2010 VILNIUS, LITHUANIA. Participants REPORT

Module Title: French 4

calls.paris-neuroscience.fr Tutoriel pour Candidatures en ligne *** Online Applications Tutorial

Réunion de Concertation Pluridisciplinaire (RCP) et Expertise Médico-Judiciaire. F. Lucht - CHU St Etienne Lyon, le 10/04/2013

Bienvenue. #TwitterMobile

Invitation / CTI. CeBIT «SWISS Pavilion» Research & Innovation Applied Research, Basic Research, Emerging Technologies, Start-ups, Spin-offs

1 400 HKD / year (Season : 21/09/ /06/2016)

Natixis Asset Management Response to the European Commission Green Paper on shadow banking

FÉDÉRATION INTERNATIONALE DE NATATION Diving

Transcription:

Nancy-Université M1 Master Informatique 2006-2007 Techniques de réécriture et transformations Transformations XSLT 1 Liste de personnes Dans cet exercice, on vous demande de transformer en HTML le fichier XML suivant: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="ws1.xsl"?> <PERSONNES> <PERSONNE> <NOM>Mark Wilson</NOM> <ADRESSE>911 Somewhere Circle, Canberra, Australia</ADRESSE> <TEL>(++612) 12345</TEL> <FAX>(++612) 12345</FAX> <EMAIL>Mark.Wilson@somewhere.com</EMAIL> </PERSONNE> <PERSONNE> <NOM>Tracey Wilson</NOM> <ADRESSE>121 Zootle Road, Cape Town, South Africa</ADRESSE> <TEL>(++2721) 531 9090</TEL> <FAX>(++2721) 531 9090</FAX> <EMAIL>Tracey.Wilson@somewhere.com</EMAIL> </PERSONNE> <PERSONNE> <NOM>Jodie Foster</NOM> <ADRESSE>30 Animal Road, New York, USA</ADRESSE> <TEL>(++1) 3000 12345</TEL> <FAX>(++1) 3000 12345</FAX> <EMAIL>Jodie.Foster@somewhere.com</EMAIL> </PERSONNE> <PERSONNE> <NOM>Lorrin Maughan</NOM> <ADRESSE>1143 Winners Lane, London, UK</ADRESSE> <TEL>(++94) 17 12345</TEL> <FAX>(++94) 17 12345</FAX> <EMAIL>Lorrin.Maughan@somewhere.com</EMAIL> </PERSONNE> </PERSONNES> Le HTML généré devra ressembler à ceci:

<HTML> <HEAD> <TITLE>Exo1</TITLE> </HEAD> <BODY> <TABLE BORDER="2"> <TR> <TD>Nom</TD> <TD>Adresse</TD> <TD>Tel</TD> <TD>Fax</TD> <TD>Email</TD> </TR> <TR> <TD>Mark Wilson</TD> <TD>911 Somewhere Circle, Canberra, Australia</TD> <TD>(++612) 12345</TD> <TD>(++612) 12345</TD> <TD>Mark.Wilson@somewhere.com</TD> </TR>... <TABLE> </BODY> </HTML> 2

2 Compter les livres Le but de cet exercice est d utiliser la fonction count de XPath pour transformer un document XML en HTML. On considere le fichier livres.xml ci-dessous et vous devez écrire le fichier xsl permettant d afficher le message suivant: Nombre de livre avec la note 4.5 = 2 Nombre de livre avec la note 4 = 2 <livres> <nom link="http://www.amazon.com/exec/obidos/asin/0789722429">xml by Example</nom> <auteur>benoit Marchal</auteur> <prix>24.99</prix> <promotion>17.49</promotion> <note>4.5</note> <editeur>que</editeur> <nom link="http://www.amazon.com/exec/obidos/asin/0789722427">xml by Example 2</nom> <auteur>benoit Marchal</auteur> <prix>24.99</prix> <promotion>17.49</promotion> <note>4.5</note> <editeur>que</editeur> <nom link="http://www.amazon.com/exec/obidos/asin/0735605628">xml</nom> <auteur>william J. Pardi</auteur> <prix>49.99</prix> <promotion>32.99</promotion> <note>4</note> <editeur>microsoft Press</editeur> <nom link="http://www.amazon.com/exec/obidos/asin/0735605631">xml in Action</nom> <auteur>william J. Pardi</auteur> <prix>39.99</prix> <promotion>31.99</promotion> <note>3.5</note> <editeur>microsoft Press</editeur> <nom link="http://www.amazon.com/exec/obidos/asin/0735605629">xml 2</nom> <auteur>william J. Pardi</auteur> <prix>49.99</prix> 3

<promotion>35.99</promotion> <note>4</note> <editeur>microsoft Press</editeur> </livres> On utilisera pour faire cet exercice la fonction count, qui permet de dénombrer les livres qui possèdent une certaine note (ici, 4.5 et 4). Question: dans votre fichier XSL, modifier ensuite le code en vous plaçant dans le contexte de l élément <livres>. 4

3 Articles sur les pingouins Voici un fichier XML. Nous allons utiliser xsl:template pour définir des règles de transformation d un noeud indépendamment d un contexte donné. <article> <date>28/06/2000 12:30</date> <title>rescued penguins swim home</title> <para><place>cape Town</place> Some 150 penguins unaffected by the oil spill began their long swim from Port Elizabeth in the Eastern Cape back to their breeding habitat at Robben Island near Cape Town on Wednesday. </para> <para>the penguins, who have all been tagged, were transported in a truck hired by the <company>south African National Conservation of Coastal Birds (Sanccob)</company> to Port Elizabeth on Tuesday night. </para> <para>its not known how many more birds will be released from Port Elizabeth after receiving treatment. </para> <para>more than <link ref="www.newsrus.com/oilspill.html">400 tons of fuel oil escaped from the bulk ore carrier Treasure</link> before divers were able to seal the holds.</para> <para>the ship was carrying 130 000 tons of iron ore and 1 300 tons of fuel oil when she sank off the Cape West coast last Friday. </para> <para>a spokesperson for <company>sanccob</company>, Christina Pretorius said the centre had a capacity to treat 1 000 penguins but presently there were in excess of 4 500 birds being rehabilitated and more would be brought to the centre on Wednesday. </para> <source>john Rolfe</source> </article> Question: écrire le fichier XSL qui permet d obtenir le fichier HTML suivant? 28/06/2000 12:30 Rescued penguins swim home Cape Town - Some 150 penguins unaffected by the oil spill began their long swim from Port Elizabeth in the Eastern Cape back to their breeding habitat at Robben Island near Cape Town on Wednesday. The penguins, who have all been tagged, were transported in a truck hired by the South African National Conservation of Coastal Birds (Sanccob) to Port Elizabeth on Tuesday night. Its not known how many more birds will be released from Port Elizabeth after receiving treatment. More than 400 tons of fuel oil escaped from the bulk ore carrier Treasure before divers were able to seal the holds. 5

Essayez chaque modification une par une. Une fois que vous avez testé la modification, revenez à l original avant de tester les modifications suivantes. 1. supprimez le template correspondant à link et expliquez ce qui se passe. 2. supprimez le contenu du template correspondant à place et expliquez ce qui se passe. 3. après l instruction <xsl:template match= / >, modifiez le template <xsl:apply-templates/> afin qu il ne repère que les éléments para et source. 6

4 Toujours les pingouins Pour cet exercice, on utilise l instruction xsl:value-of. Cette instruction n a d effet que sur le noeud dans le contexte. On utilise le fichier pingouins.xml. Il faut remplacer dans le fichier XSL l instruction xsl:applytemplates pour l élément para par une instruction xsl:value-of: <xsl:template match="para"> <p> <xsl:apply-templates/></p> </xsl:template> On utilise l instruction suivante: <xsl:value-of select="."/> Question: quel est le résultat dans ce cas? Proposez une solution alternative. 7

5 Final On utilise le fichier XML des livres: <livres> <nom link="http://www.amazon.com/exec/obidos/asin/0789722429/vbxml">xml by Example</nom> <auteur>benoit Marchal</auteur> <prix>24.99</prix> <promotion>17.49</promotion> <note>4.5</note> <editeur>que</editeur> </livres> Objectif: Ecrivez le fichier XSL qui permet d obtenir le fichier HTML suivant: On envisagera deux méthodes, une procédurale, l autre étant basée sur des règles. 8