Forum

Forum (https://www.coolstreaming.us/forum/)
-   Hardware & Software (https://www.coolstreaming.us/forum/a/)
-   -   PROBLEMI con un XSL... (https://www.coolstreaming.us/forum/a/38891-a.html)

ABNormal 11-04-2007 01:18 PM

PROBLEMI con un XSL...
 
questo xsl mi gestisce una lista:
HTML Code:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body style="color: rgb(204, 255, 255); background-color: rgb(255, 255, 255); background-image: url(background.jpg);" alink="#ffffcc" link="#ccffff" vlink="#66ffff"> <xsl:apply-templates> </xsl:apply-templates> </body> </html> </xsl:template> <xsl:template match="Contents"> <xsl:for-each select = "Movie"> <xsl:sort select="OriginalTitle" data-type="text" /> <xsl:choose> <xsl:when test="Category = MOVIES"> <h1><xsl:value-of select="OriginalTitle" /></h1><br /> <h1><xsl:value-of select="Category" /></h1> </xsl:when> <xsl:otherwise> <h6><xsl:value-of select="Category" /></h6> <h6><xsl:value-of select="OriginalTitle" /></h6><br /> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> </xsl:stylesheet>


stranamente sebbene in Category una possibile definizione è MOVIES, lo script xsl mi mostra tutto in formato <.h6.> anche per i dati che hanno categoria MOVIES


qualcuno (Ogher immagino :rolleyes: ) sa gentilmente capirne il perchè?

ABN

Ogher 11-04-2007 01:36 PM

il problema è qui:
HTML Code:
<xsl:when test="Category = MOVIES">

il costrutto
when espressioneDaValutare
.......
otherwhise
........

funziona come un if else e in questo caso ti mostra i movies in h6 semplicemente perchè fallisce (restituisce false) l'espressione Category = MOVIES e quindi usa il contenuto di otherwise
basta sistemare l'espressione e dovrebbe funzionare, ti scrivo una possibile soluzione dato che non conosco bene la sintassi:
HTML Code:
<xsl:when test="Category='MOVIES'">

ABNormal 11-04-2007 02:51 PM

Quote:
Originally Posted by Ogher
il problema è qui:
HTML Code:
<xsl:when test="Category = MOVIES">

il costrutto
when espressioneDaValutare
.......
otherwhise
........

funziona come un if else e in questo caso ti mostra i movies in h6 semplicemente perchè fallisce (restituisce false) l'espressione Category = MOVIES e quindi usa il contenuto di otherwise
basta sistemare l'espressione e dovrebbe funzionare, ti scrivo una possibile soluzione dato che non conosco bene la sintassi:
HTML Code:
<xsl:when test="Category='MOVIES'">

avevo provato l'opzione contraria (@category=MOVIES) ma non aveva funzionato.
appena torno a casa ci riproo
grazie mille
ABN


All times are GMT +2. The time now is 12:46 PM.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.