Perl:XSLT

From Progzoo
Jump to: navigation, search
Italian Job Infobox.png

You can process XHTML files if they are consistent.

  • In these examples you look at Wikipedia pages about films.
  • The pages are consistent thanks to the Infobox Film template.

We will look at two examples of movies, The Italian Job from 1969 and Brazil from 1985.

<table cellspacing="5" style="width: 22em; text-align: left; line-height: 1.5em; font-size: 90%;" class="infobox vevent">
 <tbody>
  <tr>
   <td style="text-align: center; font-weight: bold; font-size: 110%;" class="summary" colspan="2"><i>The Italian Job</i></td>
  </tr>
  <tr>
   <td style="text-align: center;" class="" colspan="2"> ... <br/>
    <span style="font-size: 95%; line-height: 1.5em;"><b>UK Theatrical 1999 re-release poster</b></span></td>
  </tr>
  <tr>
   <th style="white-space: nowrap;">Directed by</th>
   <td style="" class="description"><a title="Peter Collinson (film director)" href="/wiki/Peter_Collinson_(film_director)">Peter Collinson</a></td>
  </tr>
  <tr>
  <th style="white-space: nowrap;">Produced by</th>
  <td style="" class=""><a title="Michael Deeley" href="/wiki/Michael_Deeley">Michael Deeley</a></td>
  </tr>
  <tr>
   <th style="white-space: nowrap;">Written by</th>
   <td style="" class=""><a title="Troy Kennedy Martin" href="/wiki/Troy_Kennedy_Martin">Troy Kennedy Martin</a></td>
  </tr>
  <tr>
  <th style="white-space: nowrap;">Starring</th>
  <td style="" class=""><a title="Michael Caine" href="/wiki/Michael_Caine">Michael Caine</a><br/>
  <a title="Noël Coward" href="/wiki/No%C3%ABl_Coward">Noël Coward</a><br/>
  <a title="Benny Hill" href="/wiki/Benny_Hill">Benny Hill</a><br/>
  <a title="Raf Vallone" href="/wiki/Raf_Vallone">Raf Vallone</a><br/>
  <a title="Tony Beckley" href="/wiki/Tony_Beckley">Tony Beckley</a><br/>
  <a title="Rossano Brazzi" href="/wiki/Rossano_Brazzi">Rossano Brazzi</a></td>
  </tr>
..
 </tbody>
</table>

Directed by Phrase

The default template finds the th node inside the infobox that contains the the text 'Director'.

Change the select attribute so that in parent is output.


[Font] [Default] [Show] [Resize] [History] [Profile]

Director

The default template finds the th node inside the infobox that contains the the text 'Director'.

Change the select attribute so that in parent is output.


[Font] [Default] [Show] [Resize] [History] [Profile]

Producer

Show the producer(s) of the movie.


[Font] [Default] [Show] [Resize] [History] [Profile]