Foros del Web » Programación para mayores de 30 ;) » Programación General »

Verde..muy verde en XML por qué no logro ver el documento??

Estas en el tema de Verde..muy verde en XML por qué no logro ver el documento?? en el foro de Programación General en Foros del Web. Que tal señores...primer post aqui.. quiero emezar a hacer algunas cosas en xml pero no le doy.. ví un ejemplo por ahi y lo copié ...
  #1 (permalink)  
Antiguo 22/06/2004, 10:20
 
Fecha de Ingreso: marzo-2003
Ubicación: onde toy?
Mensajes: 1.437
Antigüedad: 21 años, 1 mes
Puntos: 9
Verde..muy verde en XML por qué no logro ver el documento??

Que tal señores...primer post aqui.. quiero emezar a hacer algunas cosas en xml pero no le doy.. ví un ejemplo por ahi y lo copié tal cualll pero al abrirlo con el explorer se vé como si ubiera escrito el código en un block de notas...osea.. haber para que lo entiendan se vé asi como el código escrito..

<?xml version="1.0"?>

<!-- File Name: Inventario.xml -->

<INVENTARIO>
<LIBRO>
<TITULO>Las aventuras de Huckleberry Finn</TITULO>
<AUTOR>Mark Twain</AUTOR>
<PAGINAS>298</PAGINAS>
<PRECIO>$7.49</PRECIO>
</LIBRO>
<LIBRO>
<TITULO>Leaves of Grass</TITULO>
<AUTOR>Walt Whitman</AUTOR>
<PAGINAS>462</PAGINAS>
<PRECIO>$9.75</PRECIO>
</LIBRO>
<LIBRO>
<TITULO>La legenda de Sleepy Hollow</TITULO>
<AUTOR>Washington Irving</AUTOR>
<PAGINAS>98</PAGINAS>
<PRECIO>$3.95</PRECIO>
</LIBRO>
<LIBRO>
<TITULO>The Marble Faun</TITULO>
<AUTOR>Nathaniel Hawthorne</AUTOR>
<PAGINAS>473</PAGINAS>
<PRECIO>$10.95</PRECIO>
</LIBRO>
<LIBRO>
<TITULO>Moby-Dick</TITULO>
<AUTOR>Herman Melville</AUTOR>
<PAGINAS>724</PAGINAS>
<PRECIO>$13.56</PRECIO>
</LIBRO>
<LIBRO>
<TITULO>El retrato de una joven</TITULO>
<AUTOR>Henry James</AUTOR>
<PAGINAS>256</PAGINAS>
<PRECIO>$4.32</PRECIO>
</LIBRO>
<LIBRO>
<TITULO>The Scarlet Letter</TITULO>
<AUTOR>Nathaniel Hawthorne</AUTOR>
<PAGINAS>253</PAGINAS>
<PRECIO>$4.25</PRECIO>
</LIBRO>
<LIBRO>
<TITULO>The Turn of the Screw</TITULO>
<AUTOR>Henry James</AUTOR>
<PAGINAS>384</PAGINAS>
<PRECIO>$4.36</PRECIO>
</LIBRO>
</INVENTARIO>

se ven los tags y todas esas cosas...
__________________
Buena Vida...
Francisco
  #2 (permalink)  
Antiguo 23/06/2004, 06:13
 
Fecha de Ingreso: mayo-2004
Mensajes: 75
Antigüedad: 20 años
Puntos: 2
La forma de visualizar el fichero xml como si lo hubieras escrito en el notepad (aunque bueno es un poco diferente porque te lo abre como si fuera un arbol) es la forma por defecto que tiene el explorer de mostrar un fichero xml.

Tu fichero no tiene una hoja de estilo asociada por eso el explorer te lo muestra con su formato por defecto.

Ya veras haz la siguiente prueba:

Pon en tu fichero xml esta linea:

<?xml:stylesheet type="text/xsl" href="prueba.xsl"?>

justo debajo de la que ponia:
<?xml version="1.0"?>

Ahora crea en el mismo directorio donde tienes tu fichero xml un fichero llamado prueba.xsl, dentro de este fichero pon por ejemplo este codigo:

Código HTML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
               version="1.0">
<xsl:template match="/">
	 <table width="90%" border="0" cellspacing="10" cellpadding="0" align="center">
		 	<tr>
		 		<td>Titulo</td>
		 		<td>autor</td>
		 		<td>paginas</td>
		 		<td>precio</td>
		 	</tr>			
		 	<xsl:for-each select="//LIBRO">
			 	<tr>
		 		<td><xsl:value-of select="./TITULO/text()"/></td>	 		
		 		<td><xsl:value-of select="./AUTOR/text()"/></td>	 		
		 		<td><xsl:value-of select="./PAGINAS/text()"/></td>	 		
		 		<td><xsl:value-of select="./PRECIO/text()"/></td>	 				 				 				 		
				</tr>		 		
			</xsl:for-each>	
    </table>
</xsl:template>
</xsl:stylesheet> 
Ahora cuando abras el fichero xml con el navegador deberias verlo diferente.

Echale un vistazo a XSLT.

Última edición por soniagrande; 23/06/2004 a las 06:16
  #3 (permalink)  
Antiguo 23/06/2004, 10:17
 
Fecha de Ingreso: marzo-2003
Ubicación: onde toy?
Mensajes: 1.437
Antigüedad: 21 años, 1 mes
Puntos: 9
Gracias SoniaGrande te pasaste.. voy a checar XSLT gracias
__________________
Buena Vida...
Francisco
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:14.