Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [XML] Problema con foglio di stile

    ciao.

    ho il seguente file xml :
    codice:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet href="Ricettario.xsl" type="text/xsl"?>
    <!DOCTYPE Ricettario SYSTEM "Ricettario.dtd">
    <Ricettario>
    	<Ricetta>
    		<Nome>xxxx</Nome>
    		<Portata>xxxxx</Portata>
    		<NumeroPersone>xxx</NumeroPersone>
    		<Ingredienti>
    			<Ingrediente>1</Ingrediente>
    			<Ingrediente>2</Ingrediente>
    			<Ingrediente>3</Ingrediente>
    			<Ingrediente>4</Ingrediente>
    		</Ingredienti>
    		<Preparazione>aaaaaaaa</Preparazione>
    	</Ricetta>
    ho creato il foglio di stile cosi :

    codice:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    <xsl:template match=".">
    	<html>
    		<head>
    			<Title>Ricettario di Daniele Boncompagni</Title>
    		</head>
    		<body bgcolor="green">
    			<xsl:for-each select="Ricettario">
    				<hr/>
    				<h2 align="center">Ricettario</h2>
    				<hr/>
    				<xsl:for-each select="Ricetta">
    					<h2><xsl:value-of select="Nome"/></h2>
    					<p align="left">Ingredienti per <xsl:value-of select="NumeroPersone"/> persone</p>
    					<xsl:for-each select="Ingredienti">
    						<xsl:value-of select="Ingrediente"/>
    					</xsl:for-each>
    					
    
    Preparazione : 
    					<xsl:value-of select="Preparazione"/>
    					</p>
    				</xsl:for-each>
    			</xsl:for-each>
    		</body>
    	</html>
    </xsl:template>
    </xsl:stylesheet>
    mi aspettavo che mi comparissero tutti gli ingredienti, ma ne esce solo uno. dove stà l'errore ??

  2. #2
    codice:
    <xsl:for-each select="Ingredienti/Ingrediente">
       <xsl:value-of select="."/>
    </xsl:for-each>
    il cicloo lo fai su ogni elemento "ingrediente" non "ingredienti"
    "0 è tutto finito. 1 è solo l'inizio"
    HO IL CERTIFICATO DI RESISTENZA.

  3. #3
    grazie mille !!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.