Vous êtes sur la page 1sur 14

Document Type Definition.

DTD
<!ELEMENT nombreElemento (TIPOELEMENTO)> &#decimal; &#xHexadecimal;
Siendo TIPOELEMENTO: &oacute;
#PCDATA una cadena &lt; <
Lista_elementos
separado por , para indicar secuencia
&gt; >
separado por | para indicar alternativas &quote;
seguido de ? =0..1 Opcional. &amp; &
seguido de * =0..n Opcional y Repetible &nbsp; espacio
seguido de + =1..n Requerido y Repetible
EMPTY sin contenido, normalmente se le definen atributos
En XML sera <disco formato=CD titulo=hola />
ANY cualquier tipo de contenido, es demasiado libre
Utilizar atributos cuando su contenido no sea susceptible de contener otros elementos. Los
valores de los atributos debern ir entre comillas.
<!ATTLIST nombreElemento
nombreAtributo TIPOATRIBUTO OBLIGATORIO
nombreAtributo TIPOATRIBUTO OBLIGATORIO >
Siendo TIPOATRIBUTO:
CDATA una cadena
(Lista_valores separado por | para indicar posibles valores)
ID -> Idenitficador nico
IDREF ->
NMTOKEN ->
Siendo OBLIGATORIO:
#REQUIRED -> el atributo es obligatorio
#IMPLIED -> el atributo es opcional
#FISXED -> el atributo siempre tiene le mismo valor
valorPredeterminado
Se pueden definir sinnimos ENTITY para ahorrar escribir en las definiciones
<!ENTITY % nombreSinonimo Definicin> % indica que es una entidad parmetro
p.ejemplo <!ENTITY % mediaObj audio|video|text>
<!ENTITY % SupermediaObj %mediaObj;|olor|sabor>
<!ENTITY nombreSinonimo Definicin>
<!ENTITY oacute >
&oacute; & indica que es una entidad
<!ELEMENT root (row)+ >
<!ELEMENT row (field)+ >
<!ELEMENT field (#PCDATA) >
<!ATTLIST field name CDATA #REQUIRED >

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE root SYSTEM "borrame.dtd">
<root>
<row>
<field name="E">1000</field>
<field name="Nombre">Espasa</field>
<field name="Ciudad">M</field>
<field name="E">1000</field>
<field name="L">100</field>
<field name="UNIDADES">50200</field>
</row>
<row>
<field name="E">1000</field>
<field name="Nombre">Espasa</field>
<field name="Ciudad">M</field>
<field name="E">1000</field>
<field name="L">130</field>
<field name="UNIDADES">10000</field>
</row>
</root>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="fac1.xsl"?>
<!DOCTYPE facturacion [
<!ELEMENT facturacion (factura)*>
<!ELEMENT factura (billete)*>
<!ATTLIST factura cif CDATA #REQUIRED
Numero CDATA #REQUIRED
fecha CDATA #REQUIRED>
<!ELEMENT billete (vuelo+, extras, importebruto, descuentos, subvencionneta)>
<!ATTLIST billete numero CDATA #REQUIRED
Fecha CDATA #REQUIRED>
<!ELEMENT vuelo (cupon)+>
<!ATTLIST vuelo numero CDATA #REQUIRED
Fecha CDATA #REQUIRED
hora CDATA #REQUIRED
cif CDATA #REQUIRED
origen CDATA #REQUIRED
destino CDATA #REQUIRED>
<!ELEMENT cupon EMPTY>
<ATTLIST cupon dni CDATA #REQUIRED
Tiposub CDATA #IMPLIED >
<!ELEMENT extras (extra)+>
<ATTLIST extras total CDATA #REQUIRED
<!ELEMENT extra (valor)> Cmo consigo que extra tenga texto?
<!ELEMENT valor (#PCDATA)>
<!ELEMENT importebruto (#PCDATA)>
<!ELEMENT descuentos (#PCDATA)>
<!ELEMENT subvencionneta (#PCDATA)>
]>
<facturacion>
<factura cif="A898900H" num="000345/01" fec="25-02-2001">
<billete numero="AV000023" fecha="01-01-2001">
<vuelo numero="IB7441" fecha="02-01-2001" hora="17:45" cif="A898900H" origen="LZT" destino="TFE">
<cupon dni="05360998" tiposubvencion="10" />
</vuelo>
<vuelo numero="IB7451" fecha="02-01-2001" hora="22:45" cif="A898900H" origen="TFE" destino="MAD">
<cupon dni="05360998" tiposubvencion="10" />
</vuelo>
<extras total="500">
<extra> clase VIP <valor> 200 </valor></extra>
<extra> consumicin <valor> 300 </valor></extra>
</extras>
<importebruto>16000</importebruto>
<descuentos>0</descuentos>
<subvencionneta>1600</subvencionneta>
</billete>
<billete numero="AV000024" fecha="03-01-2001">
<vuelo numero="IB7442" fecha="04-01-2001" hora="19:45" cif="B898900H" origen="LZT" destino="TFE">
<cupon dni="A5360998" tiposubvencion="11" />
</vuelo>
<vuelo numero="IB7452" fecha="02-01-2001" hora="22:45" cif="A898900H" origen="TFE" destino="MAD">
<cupon dni="B5360998" tiposubvencion="12" />
</vuelo>
<importebruto>26000</importebruto>
<descuentos>2</descuentos>
<subvencionneta>2600</subvencionneta>
</billete>
</factura>
</facturacion>
<!ELEMENT coleccion (persona*)>
<!ELEMENT persona (nombre, fechanacimiento?, genero?, telefono+)>
<!ELEMENT nombre (#PCDATA) >
<!ELEMENT fechanacimiento (#PCDATA) >
<!ELEMENT genero (#PCDATA) >
<!ELEMENT numeroseguridadsocial (#PCDATA) >

<?xml version="1.0" encoding="UTF-8" standalone=no?>


<!-- standalone=yes cuando la dtd sea interna -->
<!DOCTYPE coleccion SYSTEM "ejemplo1.dtd">
< coleccion>
<persona>
<nombre>Jos Garca</nombre>
<fechanacimiento>25/04/1984</fechanacimiento>
<genero>Varn</genero>
<telefono>967 484 850</telefono>
<telefono>967 484 698</telefono>
<telefono>660 485 048</telefono>
</persona>
</coleccion>
<!ELEMENT root (etiqueta1| etiqueta2| etiqueta3| etiqueta4)*>
<!ELEMENT etiqueta1 #PCDATA>
<!ELEMENT etiqueta2 #PCDATA>
<!ELEMENT etiqueta3 #PCDATA>
<!ELEMENT etiqueta4 #PCDATA>

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE root SYSTEM "ejemplo2.dtd">
<root>
<etiqueta3>Jos Garca</etiqueta3>
<etiqueta1>Jos Garca</etiqueta1>
<etiqueta2>Jos Garca</etiqueta2>
<etiqueta1>Jos Garca</etiqueta1>
<etiqueta3>Jos Garca</etiqueta3>
<etiqueta4>Jos Garca</etiqueta4>
</root>
COMPARATIVA :
DTD XML Schema Comentarios
Crea un vnculo entre un nombre y
ELEMENT <element> unos atributos, modelos de contenido y
anotaciones
#PCDATA <simpleType>predefinidos
<complexType> Se elimina la existencia de elementos
EMPTY
sin elementos descendientes del actual.
Jerarqua <complexType>

, (secuencia) <sequence>

| (alternativas) <choice>
? (Opcional) Se han de emplear los atributos
+(Requerido y Repetible) Soportado predefinidos de maxOccurs y
*(Opcional y Repetible) minOccurs
Se pueden agrupar declaraciones de
ATTLIST <attributeGroup>
<attributes>
Tipo de atributo CDATA, ID,
<simpleType>predefinidos
IDREF, NOTATION, ...
ENTITY NO Soportado Las entidades son declaradas en
declaraciones de marcas en el XML
XMLSchema.xsd
xsd:puede ser cualquier cadena

<?xml version="1.0" encoding="UTF-8"?>


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Libro">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Ttulo" type="xsd:string"/>
<xsd:element name="Autores" type="xsd:string" maxOccurs="10"/>
<xsd:element name="Fe_Ed" type="xsd:date" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="precio" type="xsd:double"/>
<xsd:attribute name="isbn" type="xs:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

<?xml version="1.0" encoding="UTF-8"?>


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- definition of simple type elements -->
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="since" type="xs:date"/>
<!-- definition of attributes -->
<xs:attribute name="isbn" type="xs:string"/>
<!-- definition of complex type elements -->
<xs:element name="character">
<xs:complexType>
<xs:sequence>
<xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="since"/>
<!-- the simple type elements are referenced using the "ref" attribute -->
<!-- the definition of the cardinality is done when the elements are referenced -->
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element ref="title"/>
<xs:element ref="author"/>
<xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute ref="isbn"/>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- definition of simple types -->
<xs:simpleType name="Cadena32">
<xs:restriction base="xs:string">
<xs:maxLength value="32"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="isbnType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{10}"/>
</xs:restriction>
</xs:simpleType>
<!-- definition of complex types -->
<xs:complexType name="characterType">
<xs:sequence>
<xs:element name="ventas" type="Cadena32"/>
<xs:element name="FechaEdi" type="xs:date" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="bookType">
<xs:sequence>
<xs:element name="title" type="Cadena32"/>
<xs:element name="author" type="Cadena32"/>
<xs:element name="character" type="characterType" minOccurs="0" maxOccurs="unbounded"/>
<!-- "character" element is del tipo complejo "characterType" -->
</xs:sequence>
<xs:attribute name="isbn" type="isbnType" use="required"/>
</xs:complexType>
<!-- Reference to "bookType" to define the "book" element -->
<xs:element name="book" type="bookType"/>
</xs:schema>

<?xml version="1.0"?>
<hojaPedido fechaPedido="1999-10-20">
<enviarA pais="EEUU">
<nombre>Alice Smith</nombre>
<calle>123 Maple Street</calle>
<ciudad>Mill Valley</ciudad>
<estado>CA</estado>
<zip>90952</zip>
</enviarA>
<facturarA pais="EEUU">
<nombre>Robert Smith</nombre>
<calle>8 Oak Avenue</calle>
<ciudad>Old Town</ciudad>
<estado>PA</estado>
<zip>95819</zip>
</facturarA>
<comentario>Deprisa, mi csped parece una selva!</comentario>
<elementos>
<elemento numProducto="872-AA">
<nombreProducto>Cortacesped</nombreProducto>
<cantidad>1</cantidad>
<precioEEUU>148.95</precioEEUU>
<comentario>Confirmar que es elctrico</comentario>
</elemento>
<elemento numProducto="926-AA">
<nombreProducto>Monitor para bebes</nombreProducto>
<cantidad>1</cantidad>
<precioEEUU>39.98</precioEEUU>
<fechaEnvio>1999-05-21</fechaEnvio>
</elemento>
</elementos>
</hojaPedido>
Le corresponde
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="es">
Esquema de hoja de pedido para Example.com.
Copyright 2000 Example.com. Todos los derechos reservados.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="hojaPedido" type="TipoHojaPedido"/>
<xsd:element name="comentario" type="xsd:string"/>
<xsd:complexType name="TipoHojaPedido">
<xsd:sequence>
<xsd:element name="enviarA" type="direccionEEUU"/>
<xsd:element name="facturarA" type="direccionEEUU"/>
<xsd:element ref="comentario" minOccurs="0"/>
<xsd:element name="elementos" type="Elementos"/>
</xsd:sequence>
<xsd:attribute name="fechaPedido" type="xsd:date"/>
</xsd:complexType>
<xsd:complexType name="direccionEEUU">
<xsd:sequence>
<xsd:element name="nombre" type="xsd:string"/>
<xsd:element name="calle" type="xsd:string"/>
<xsd:element name="ciudad" type="xsd:string"/>
<xsd:element name="estado" type="xsd:string"/>
<xsd:element name="zip" type="xsd:decimal"/>
</xsd:sequence>
<xsd:attribute name="pais" type="xsd:NMTOKEN" fixed="EEUU"/>
</xsd:complexType>
<xsd:complexType name="Elementos">
<xsd:sequence>
<xsd:element name="elemento" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nombreProducto" type="xsd:string"/>
<xsd:element name="cantidad">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="precioEEUU" type="xsd:decimal"/>
<xsd:element ref="comentario" minOccurs="0"/>
<xsd:element name="fechaEnvio" type="xsd:date" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="numProducto" type="TipoNumP" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Stock Keeping Unit [Cdigo de Almacenaje], -->
<!-- un cdigo para identificar productos -->
<xsd:simpleType name=" TipoNumP ">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{3}-[A-Z]{2}"/>
<!-- tres dgitos seguidos de un guin seguido de dos caracteres ASCII en maysculas -->
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>

Para los Elementos los atributos minOccurs y el maxOccurs es 1 y se le puede asignar unbounded
[sin lmite]. Para los atributos su atributo use puede ser required y otional
Los valores por defecto de elementos y atributos son declarados utilizando el atributo default
Tipo Simple Ejemplos (delimitados por comas)
string Confirmar que es elctrico
token Confirmar que es elctrico
byte -1, 126
unsignedByte 0, 126
integer -126789, -1, 0, 1, 126789
positiveInteger 1, 126789
negativeInteger -126789, -1
int -1, 126789675
unsignedInt 0, 1267896754
long -1, 12678967543233
unsignedLong 0, 12678967543233
short -1, 12678
unsignedShort 0, 12678
decimal -1.23, 0, 123.4, 1000.00
float -INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN
double -INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN
boolean true, false 1, 0
time 13:20:00.000, 13:20:00.000-05:00
dateTime 1999-05-31T13:20:00.000-05:00
date 1999-05-31
anyURI http://www.example.com/, http://www.example.com/doc.html#ID5
ID
IDREF
NMTOKEN US, Brasil
Propiedades de tipos simples:
Todos: pattern, enumeration, whiteSpace
Cadenas: Length, minLength, maxLength,
Nmeros y fechas: minInclusive,maxInclusive, minExclusive, maxExclusive,
Nmeros: totalDigits, fractionDigits
<!--&oacute; -->
<xsd:element name="oacute" type="xsd:token" fixed=""/>
Definicin de miEntero, rango de 10000-99999
<xsd:simpleType name="miEntero">
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="10000"/>
<xsd:maxInclusive value="99999"/>
</xsd:restriction>
</xsd:simpleType>
Utilizacin de la Propiedad Enumeration
<xsd:simpleType name="estadoEEUU">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AK"/>
<xsd:enumeration value="AL"/>
<xsd:enumeration value="AR"/>
<!-- y as el resto ... -->
</xsd:restriction>
</xsd:simpleType>
Crear una Lista de 6 elementos miEntero
<xsd:simpleType name="listaDeMisEnteros">
<xsd:list itemType="miEntero"/>
<xsd:length value="6"/>
</xsd:simpleType>

Y un elemento en un documento instancia sera:

<listaDeMisEnteros>20003 15037 95977 95945</listaDeMisEnteros


MIXTO La construccin del esquema puede caracterizarse por elementos que contienen subelementos,
y los elementos del nivel ms profundo contienen datos. Tambin es posible esquemas en los que los
datos pueden aparecer junto con los subelementos, y los datos no estn confinados al ms profundo de
los niveles:
<cuerpoCarta>
<saludo>Querido Sr.<nombre>Robert Smith</nombre>.</saludo>
Su pedido de <cantidad>1</cantidad> <nombreProducto>
Monitor de Bebs</nombreProducto> fue enviado desde nuestro
almacn el <fechaEnvio>1999-05-21</fechaEnvio>. ....
</cuerpoCarta>
Fragmento de Esquema para Carta de Cliente
<xsd:element name="cuerpoCarta">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="saludo">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="nombre" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="cantidad" type="xsd:positiveInteger"/>
<xsd:element name="nombreProducto" type="xsd:string"/>
<xsd:element name="fechaEnvio" type="xsd:date" minOccurs="0"/>
<!-- etc. -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Un Tipo Complejo Vaco
<xsd:element name="precioInternacional">
<xsd:complexType>
<xsd:attribute name="moneda" type="xsd:string"/>
<xsd:attribute name="valor" type="xsd:decimal"/>
</xsd:complexType>
</xsd:element>
Definicin de Analista por Extensin de direccionEEUU
<complexType name="Analista">
<complexContent>
<extension base="xipo:direccionEEUU">
<sequence>
<element name="telefono" type="string"/>
<element name="email" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>
Documento Instancia que Conforma con el Esquema de Informes con el Tipo Analista
<informePedidos xmlns="http://www.example.com/Report" finPeriodo="1999-12-31">
<analista>
<nombre>Wendy Uhro</nombre>
<calle>10 Corporate Towers</calle>
<ciudad>San Jose</ciudad>
<estado>CA</estado>
<zip>95113</zip>
<telefono>408-271-3366</telefono>
<email>uhro@example.com</email>
</analista>
</informePedidos>
Tipo Unin para Cdigos
<xsd:simpleType name="unionZips">
<xsd:union memberTypes="estadoEEUU listaDeMisEnteros"/>
</xsd:simpleType>
Se aplicar:
<zips>CA</zips>
<zips>95630 95977 95945</zips>
<zips>AK</zips>
Derivacin de un Tipo Complejo a partir de un Tipo Simple
<precioInternacional moneda="EUR">423.46</precioInternacional>
<xsd:element name="precioInternacional">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:decimal">
<xsd:attribute name="moneda" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>

todos los elementos de un grupo pueden aparecer una vez o ninguna, y pueden aparecer en cualquier orden
<xsd:complexType name="TipoHojaPedido">
<xsd:all>
<xsd:element name="enviarA" type="direccionEEUU"/>
<xsd:element name="facturarA" type="direccionEEUU"/>
<xsd:element ref="comentario" minOccurs="0"/>
<xsd:element name="elementos" type="Elementos"/>
</xsd:all>
<xsd:attribute name="fechaPedido" type="xsd:date"/>
</xsd:complexType>
eXtensibility Style Lenguaje. XSL
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/strict.dtd>
<!-- ESTO ES SOLO UN EJEMPLO -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<xsl:script>
<![CDATA[
var gMaxHeight = 0;
var gnumPerRow = ""
function breakRow(e) {
if (gnumPerRow == "") {
gnumPerRow = e.selectSingleNode("//options").getAttribute("numperrow");
}
return ((absoluteChildNumber(e) - 1)%gnumPerRow) == 0;
}
]]>
</xsl:script>
<xsl:script language="VBScript">
<![CDATA[
Option Explicit
Dim iResultCount
Function CountResults(n)
iResultCount = iResultCount + 1
End Function
]]>
</xsl:script>
<html xmlns=http://www.w3.org/TR/xhtnl1/strict>
<head>
<title>Facturaci&oacuote;n de &nbsp; &nbsp; subvenciones</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="ProgId" content="Access.Application" />
<meta name="VBSForEventHandlers" value="true" />
<link rel=stylesheet type=text/css href=hojaestilos.css> <!--Es escluyente de estilos locales -->
<style type=text/css> <!--para style y script en XHTML es necesario ponerlo en <![CDATA[ -->
<![CDATA[
@import URL(hoja.css);
P{color:yellow; font-size:10pt;}
]]>
</style>
<script type="text/javascript" src="../images/CSScriptLib.js"></script>
<script language="VBScript">
<!-- On Error Resume Next
Set NewDocumentButton = CreateObject("SharePoint.OpenDocuments.1")
fNewDoc = IsObject(NewDocumentButton)
Sub Window_OnLoad()
Set PivotChart.DataSource = PivotTable
End Sub
-->
<script >
<!-- function ScreenResolutionInit() {
if(window.parent.g_bInHighScreenRes) {
spanScreenResolution.style.visibility='hidden';
}
alert(L_NewDocumentRuntimeError_Text);
}
-->
</SCRIPT>
<OBJECT classid="CLSID:0002E553-0000-0000-C000-000000000046" id="MSODSC" tabIndex="-1"> </OBJECT>

</head>
<body bgcolor="#ffffff" onload="CSScriptInit(); >
<a ref.= onmouseover="return CSIShow( 1) onclick="CSAction(2)> onclick="removeSession(); return false;">
<img src=foto.gif height="2" width="4" border="0" alt="Image Info" /></a>
<a href="javascript:goNext()" onmouseover="this.style.color='red';return showName()"
onblur="status='';this.style.color='darkblue'">Siguiente sugerencia</a>
<a name=marcador1 />
<a href="#marcador1> ir a primera </a>
<center> <h1>Direccin &nbsp; General de Aviacin Civil</h1> </center>
<div class="rojo" >
<center> <b><i>Seccin de Tarifas</b></i> </center>
<strong> Color Management</strong>
</div>
<ol type=A start=5>
<li> Numeracin 5-E </li>
<li> Numeracin 6-F </li>
<li> Numeracin 7-G </li>
</ol>
<ul>
<li> vieta 1 </li>
<li> vieta 2</li>
<li> vieta 3 </li>
</ul>
<hr /> esto hace una linea horizontal
<b><font face="verdana" size="1">FACTURACIN </font></b>
<P> Esto es un prrafo con espaciado de prrafo anterior y posterior </P>
<P /> parrafo vacio
<br />
<pre> Respeta los espacios,sin colapsarlos </pre>
<xsl:for-each select="facturacion/factura">
<table border="0" width=100%>
<tr>
<td align=right>N.I.F. de la compaa area: </td> <td><b> <xsl:value-of select=@cif" /> </b> </td>
</tr>
<tr>
<td>nm. factura: </td> <td bgcolor="#ffcc99"> <b> <xsl:value-of select=@num" /> </b> </td>
</tr>
<tr>
<td>fecha de factura: </td> <td bgcolor="#ffcc99"> <b> <xsl:value-of select=@fecha" /> </b> </td>
</tr>
</table>
<br />
<script>
document.write(window.parent.g_ClickNextStr);
</script>
<xsl:for-each select="billete">
<p /> <hr /> Atributos: <xsl:value-of select="./@numero" />
BILLETE: <b> <xsl:value-of select=@numero" /> </b> Elementos: <xsl:value-of select="./importebruto" />
<br />
FECHA DEL BILLETE: <xsl:value-of select=@fecha" />
<table border="0">
<tr>
<th>IMPORTE BRUTO: </th>
<td bgcolor="#ffcc99"> <xsl:value-of select=importebruto" /> </td>
</tr>
<tr>
<th>DESCUENTOS: </th>
<td bgcolor="#ffcc99"> <xsl:value-of select=descuentos" /> </td>
</tr>
<tr>
<th>SUBVENCION NETA: </th>
<td bgcolor="#ffcc99"> <xsl:value-of select=subvencionneta" /> </td>
</tr>
</table>
<p /> <b>VUELOS</b> <br />
<table border="0">
<tr>
<th>NMERO</th> <th>FECHA</th> <th>HORA</th> <th>Ca Vuelo</th> <th>ORIGEN</th>
<th>DESTINO</th>
</tr>
<xsl:for-each select=vuelo">
<tr>
<td bgcolor="#ffcc99"> <xsl:value-of select=@numero" /> </td>
<td bgcolor="#ffcc99"> <xsl:value-of select=@fecha" /> </td>
<td bgcolor="#ffcc99"> <xsl:value-of select=@hora" /> </td>
<td bgcolor="#ffcc99"> <xsl:value-of select=@cif" /> </td>
<td bgcolor="#ffcc99"> <xsl:value-of select=@origen" /> </td>
<td bgcolor="#ffcc99"> <xsl:value-of select=@destino" /> </td>
</tr>
<xsl:for-each select=cupon">
<tr>
<th colspan="6">CUPON</th>
</tr>
<tr>
<th>DNI:</th> <td bgcolor="#ffcc99" colspan="2"> <xsl:value-of select=@dni" /> </td>
<th>TIPO DESC.:</th> <td bgcolor="#ffcc99" colspan="2"> <xsl:value-of select=@tiposubvencion" /></td>
</tr>
</xsl:for-each> <!-- cupon" -->
</xsl:for-each><!-- vuelo" -->
</table>
<p />
<xsl:for-each select="extras">
Se pueden usar los .. para hacer referencia al padre
EXTRAS <br />
<xsl:for-each select="extra"> . retorna concatenado todo lo que de l cuelgue
<b>extra:</b><xsl:value-of select="." />
<b>valor:</b>
<xsl:if test="valor[.='200']"> MALO </xsl:if>
<xsl:if test="valor[.!='200']"> bueno </xsl:if>
<xsl:value-of select="valor"/> <br />
</xsl:for-each>
total=<xsl:value-of select="@total"/>
</xsl:for-each>

</xsl:for-each><!-- "billete" -->


</xsl:for-each><!-- "facturacion/factura" -->

<form method="GET" action="Pagina.php" name="frmDireccin">


Localidad : <input type="text" name="localidad" size="20" value="Albacete" maxlength="30" id="fp1"><br />
Fichero: <input type="file" name="F1" size="20"><br />
Contrasea <input type=password name=clave value=predeterminado />
<input type="checkbox" name="C1" value="ON">Trabajador<br />
<input type="hidden" name="nacion" value="es">
<input type="radio" name="R1" value="V1" checked >hombre &nbsp;
<input type="radio" name="R1" value="V2">Mujer &nbsp;
<input type="radio" name="R1" value="V3">Nio<br />
Provincia: <select size="1" name="Provicia" multiple>
<option selected value="AB">ALBACETE</option>
<option value="CR">CIUDAD REAL</option>
<option value="TO">TOLEDO</option>
</select>
Observaciones <textarea name="notas" rows="3" cols="50">testo predeterminado</textarea><br />
<button name="btnHola" value="X" onclic=alert(mensaje JavaScript);> Consultar </button>
<input type="button" value="Ayuda" name="B1"><br />
<input type="submit" value="Enviar" name="btnEnviar">
<input type="reset" value="limpiar" name="btnLimpiar">
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
HOJAS DE ESTILO.CSS
.txtsub { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; text-align: justify; text-decoration:
underline}
.ernesto {position: absolute; left: 10; top:10; }
.alumnos { font-size: 14px; color: #000000; font-family: "Comic Sans MS", Verdana, Arial,
Helvetica, sans-serif; font-weight: normal;
}
H2 { FONT-SIZE: 10pt; FONT-FAMILY: Arial, Helvetica, sans-serif
}
BODY {background-color : #FFFFFF; color : #000000; font-size : 10pt;
font-family: Verdana, Arial, Helvetica, helv, sans-serif;
}
TD { color : #000000; font-size : 10pt; font-family: Verdana, Arial, Helvetica, helv, sans-serif;
}
A:LINK {COLOR:#9966FF; TEXT-DECORATION:NONE; font-weight: bold;}
A:VISITED {COLOR:#FF0000; TEXT-DECORATION:NONE;}
.forms { background-color : #E6E6E6; letter-spacing: normal; text-align: justify; text-indent: 3pt; word-
spacing: normal; padding-top: 2px; padding-right: 5px; padding-bottom: 2px; padding-left: 5px ; }
.formsTips { text-align: justify; text-indent: 15pt; word-spacing: normal; }
INPUT.forms{ letter-spacing: normal; text-align: justify; text-indent: 3pt; word-spacing: normal;padding-
top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;}
.texto {COLOR: black; FONT-FAMILY: Verdana, Arial; FONT-SIZE: 8pt; LETTER-SPACING: 1px;
LINE-HEIGHT: 13px}
.parrafo {MARGIN-LEFT: 30px; MARGIN-RIGHT: 10px; TEXT-ALIGN: justify}
Billete {COLOR: #ffcc00}
Aplicacin CSS
<?xml version=1.0 encoding=UTF-8?>
<?xml:stylesheet href=estilo.css type=text/css?>
<html>
<head> <title> titulo </title>
<link rel=stylesheet type=text/css href=hojaestilos.css><!-- es excluyente -->
<style type=text/css> <!permite combinar con estilos locales -->
@import URL(hojaestilos.css);
</style>
<style>
P {color : #000000; font-size : 10pt; font-family: Arial, Helvetica;}
TABLE P {color: yellow; font-size: x-large;}
P.azul {color: blue; font-size: medium;}
P.rojo {color: red; font-size: x-large;}
.Amarillo {COLOR: #ffcc00; FONT-FAMILY:helvetica; FONT-SIZE: 11px; }
#identificador {text-decoration: line-through}
</style>
</head>
<body>
<P> se le aplica el estilo definido para P </P>
<table><tr><td><p> se le aplica el estilo definido a P cuando est en una tabla</p></td></tr></table>
<p style=color:red; font-size:1cm;> Aplicacin individual</p>
<p class=rojo > Aplicacin por elemento y clase</p>
<p class=Amarillo > Aplicacin por clases</p>
<h1 class=Amarillo > Aplicacin por clases</h1>
<h3 id= identificador > Aplicacin por identificador</h1>
</body>
</html>

Vous aimerez peut-être aussi