[XPATH].Ej4.Ejercicio xpath EUROPA HTML

Ejercicio 4-1

<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>Países totales son {count(//pais)}</h1>
</body>
</html>

Resultado

<html>
  <head>
    <meta charset="utf-8"/>
    <title/>
  </head>
  <body>
    <h1>Países totales son 30</h1>
  </body>
</html>


Ejercicio 4-2

<html>

<head>
<meta charset="utf-8" />
<title>Ejercicio </title>
</head>
<body>
<ul>
<li type="square">{//pais[position()=1]//nombre}</li>
<li type="square">{//pais[position()=2]//nombre}</li>
<li type="square">{//pais[position()=3]//nombre}</li>
</ul>
</body>
</html>

Resultado

<html>
  <head>
    <meta charset="utf-8"/>
   <title>Ejercicio 4</title
  </head>
  <body>
    <ul>
      <li type="square">
        <nombre>Belgica</nombre>
      </li>
      <li type="square">
        <nombre>Republica Checa</nombre>
      </li>
      <li type="square">
        <nombre>Dinamarca</nombre>
      </li>
    </ul>
  </body>
</html>


Ejercicio 4-3

<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<table class="egt">
<td>
<th>{//pais[nombre="Belgica"]//nombre}</th>
<th>{//pais[nombre="Belgica"]//capital}</th>
</td>
<td>
<th>{//pais[nombre="Belgica"]//poblacion}</th>
<th>{//pais[nombre="Belgica"]//superficie}</th>
<th>{//pais[nombre="Belgica"]//pib}</th>
</td>
</table>
</body>
</html>

Resultado

<html>
  <head>
    <meta charset="utf-8"/>
    <title/>
  </head>
  <body>
    <table class="egt">
      <td>
        <th>
          <nombre>Belgica</nombre>
        </th>
        <th>
          <capital>Bruselas</capital>
        </th>
      </td>
      <td>
        <th>
          <poblacion>10.4</poblacion>
        </th>
        <th>
          <superficie>30518</superficie>
        </th>
        <th>
          <pib>27600</pib>
        </th>
      </td>
    </table>
  </body>
</html


Comentarios

Entradas populares de este blog