[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Problem with <xsl:if>

Subject: RE: Problem with <xsl:if>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 5 Apr 2009 13:48:25 +0100
RE:  Problem with <xsl:if>
> @text() is not a valid XPath expression

Actually it is a valid expression. It selects all text nodes on the
attribute axis. There aren't any, so it returns nothing (an empty sequence).

Michael Kay
http://www.saxonica.com/

>
> You should have an error
>
> Xmlizer
>
> 2009/4/5 Pierluigi Fabbris <pierluigi.fabbris@xxxxxxxx>
> >
> > In my code that Ive put down. Ive problem for the <xsl:if  
> > test="./ricetta/@id =vino_consigliato/@ricetta">
> >
> > The result should be that the program show for every
> vino_consigliato
> > in ricetta that has the same id. Why the test dont work?
> Where is the error?
> >
> > Ricettario.xml
> > -------------------
> > <?xml version="1.0" encoding="ISO8859-1"?> <!DOCTYPE
> ricettario SYSTEM
> > "ricettario.dtd"> <?xml-stylesheet type="text/xsl"
> > href="ricettario.xsl"?> <ricettario> <ricetta titolo="Zuppa
> di cipolle
> > con crostone gratinato all'emmental"
> > id="r1">
> > <ingredienti persone="4">
> > <ingrediente quantita="8"> cipolle grandi</ingrediente>
> <ingrediente
> > quantita="4 cucchiai"> farina </ingrediente> <ingrediente
> quantita="1
> > foglia"> alloro </ingrediente> <ingrediente quantita="un po'"> olio
> > d'oliva </ingrediente> <ingrediente quantita="1 litro"> brodo
> > </ingrediente> <ingrediente quantita="4 fette"> pancarrh
> > </ingrediente> <ingrediente quantita="100 grammi"> emmental
> > </ingrediente> <ingrediente quantita="q.b."> sale e pepe
> > </ingrediente> </ingredienti> <preparazione> Mettete a soffriggere
> > nell'olio d'oliva l'alloro e aggiungere la cipolla precedemente
> > affetata fine e farla cucinare a fuoco lento fino a che non
> > imbiondisce.
> > Aggiungere poi la farina e far rosolare fino a quando non prende un
> > bel colore dorato. Aggiiungere il brodo e lasciar cucinare
> ancora per
> > venti minuti circa, in modo che la zuppa so presenti ben cremosa.
> > A parte mettere le fette di pancarrh in una teglia metterci sopra
> > dell'emmental (a piacere una spolverata di paprika) e
> infornare per 8
> > minuti a forno caldo.
> > Servire la zuppa con il crostone fondente sopra.
> > </preparazione>
> > </ricetta>
> > <ricetta titolo="Canederli di zucca con radicchio trevisano
> e pancetta
> > croccante" id="r2"> <ingredienti persone="4"> <ingrediente
> > quantita="8"> panini</ingrediente> <ingrediente
> quantita="100 grammi">
> > zucca </ingrediente> <ingrediente quantita="100 grammi"> formaggio
> > asiago </ingrediente> <ingrediente quantita="2"> uova
> </ingrediente>
> > <ingrediente quantita="1 bicchiere"> latte </ingrediente>
> <ingrediente
> > quantita="un po'"> prezzemolo tritato </ingrediente> <ingrediente
> > quantita="100 grammi"> pancetta a pezzi </ingrediente> <ingrediente
> > quantita="200 grammi"> burro </ingrediente> <ingrediente
> > quantita="q.b."> sale e pepe </ingrediente> </ingredienti>
> > <preparazione> Tagliare la zuccca e cubetti, farla padellare con un
> > po' di burro e lasciarla cucinare per 10 minutii. In una bacinella
> > abbastanza capiente mettere il pane tagliato a pezzetti, le
> uova, il
> > prezzemolo, la zucca, il latte, sale e pepe.
> > Amalgamare il tutto formando un impasto morbido e omogeneo
> (in base al
> > pane usato pur cambiare la consistenza dell'impasto; se si presenta
> > troppo asciutto aggiungere un po' di latte; se si presenta troppo
> > bagnato aggiungere un po' di pane gratuggiato).
> > Formare poi dei piccoli canederli e dargli una forma un po'
> ovalizzata
> > e cucinarli per 15 minuti in acqua salata. Disporli in
> piatti a forma
> > di stella e metterci sopra il radicchio tagliato a pezzetti. In una
> > padella far abbrustolire la pancetta nel rimanente burro e
> caspargere
> > poi sopra i canederli; spolverare di parmiggiano e servire.
> > </preparazione>
> > </ricetta>
> > <vino_consigliato ricetta="r1">
> > pinot grigio
> > </vino_consigliato>
> > <vino_consigliato ricetta="r2">
> > muller thurgau
> > </vino_consigliato>
> > </ricettario>
> >
> > Ricettario.xsl
> > --------------------
> >
> > <?xml version="1.0" encoding="ISO8859-1"?> <xsl:stylesheet
> > version="1.0"
> >                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > <xsl:template match="ricettario">
> > <html>
> >                 <head>
> >                                <title> Ricette </title>
> >                 </head>
> >                 <body>
> >                 <xsl:apply-templates/>
> >                 </body>
> > </html>
> > </xsl:template>
> > <xsl:template match="ricetta">
> >                 <center>
> >                 <h1>
> >                 <xsl:value-of select="./@titolo"/>
> >                 </h1>
> >                 </center>
> >                 <br/>
> >                 <br/>
> >                 <br/>
> >                 <br/>
> >                 <xsl:apply-templates/>
> >                 <br/>
> >                 <xsl:if test="./ricetta/@id
> > =vino_consigliato/@ricetta">
> >                                <xsl:value-of
> > select="/ricettario/vino_consigliato/@text()"/>
> >                 </xsl:if>
> > </xsl:template>
> > <xsl:template match="ingredienti">
> > <table align="center">
> > <tr>
> > <td >
> > ingredienti per <xsl:value-of select="./@persone"/> persone </td>
> > </tr> <tr> <td> Quantit` </td> <td> Ingrediente </td> </tr>
> > <xsl:for-each select="ingrediente"> <tr> <td> <xsl:value-of
> > select="./@quantita"/> </td> <td> <xsl:value-of select="./text()"/>
> > </td> </tr> </xsl:for-each> </table> <br/> <br/> <br/> <br/>
> > </xsl:template> <xsl:template match="preparazione"> <p
> > align="justify">
> >                 <xsl:value-of select="./text()"/> </p>
> </xsl:template>
> > </xsl:stylesheet>
> >
> >
> > Sincerally yours.
> >
> > Fabbris Pierluigi
> > Via alle Grazie, 10/a
> > 38050 Canal San Bovo
> > Tel. 3467168672

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.