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

    [XSL] transform non funziona su firefox

    Salve ragazzi! non sono per niente pratico di xml e xls, ma sto usando un programma per catalogare divx e dvd (si chiama ant movie catalog) e sto esportando la lista in html. Ora c'è un problema, il file transform funziona solo su Internet Explorer. Come mai? si può far funzionare anche su firefox?

    codice transform.xml

    codice:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    		xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    		exclude-result-prefixes="msxsl"
    		version="1.0">
    	<xsl:output omit-xml-declaration="yes" indent="yes" />
    	<xsl:preserve-space elements="all"/>
    	<xsl:param name="selected_category" select="'All'" />
    	<xsl:param name="sort_by" select="'title'" />
    	<xsl:param name="sort_data_type" select="'text'" />
    	<xsl:param name="sort_order" select="'ascending'" />
    	<xsl:param name="mode" select="'normal_view'" />
    	<xsl:param name="movie_number" select="'1'" />
    	<xsl:param name="search" select="'false'" />
    	<xsl:param name="search_string" select="''" />
    	<xsl:param name="application_type" select="'html'" />
    	
    	<xsl:param name="show_category" select="'true'" />
    	<xsl:param name="show_country" select="'true'" />
    	<xsl:param name="show_director" select="'true'" />
    	<xsl:param name="show_year" select="'true'" />
    	
    	<xsl:template match="/"> 
    			<xsl:choose>
    				<xsl:when test="$mode = 'normal_view'">
    					<table cellpadding="0" cellspacing="0" border="0" id="mainTable" height="100%">
    					<tr><td valign="top" id="leftTD">
    						<div class="intWindow">
    							<div class="windowTitle">
    							Search
    							</div>
    							<div class="windowContent">
    							Search matches actors, directors and titles.
    							<table cellpadding="0" cellspacing="0" border="0">
    							<tr><td valign="top">
    								<input type="text" id="searchField"/>
    							</td><td valign="top">
    								Ok
    							</td></tr></table>
    							</div>
    						</div>
    						<div class="intWindow">
    							<div class="windowTitle">
    								Filter
    							</div>
    							<div class="windowContent">
    							<xsl:apply-templates select="movies" mode="create_topbar" />
    							</div>
    						</div>
    					</td><td valign="top">
    						<xsl:apply-templates select="//movies" mode="normal_view" />
    					</td></tr>
    					</table>
    				</xsl:when>
    				<xsl:when test="$mode = 'info_view'">
    					<xsl:apply-templates select="//movies" mode="info_view" />
    				</xsl:when>
    			</xsl:choose>
    	</xsl:template>
    	
    	<xsl:template match="movies" mode="create_topbar">
    		<a href="javascript:showCategory('All')">
    			<xsl:attribute name="class">
    				<xsl:choose>
    					<xsl:when test="$selected_category='All'">
    						filterSelected
    					</xsl:when>
    					<xsl:otherwise>
    						filter
    					</xsl:otherwise>
    				</xsl:choose>
    			</xsl:attribute>
    			All
    		</a>
    
    			<xsl:variable name="single_categories">
    				<xsl:apply-templates select="movie/category" mode="find_categories" />
    			</xsl:variable>
    			<xsl:for-each select="msxsl:node-set($single_categories)//subcategory[not(. = preceding::subcategory)]">
    				<xsl:sort select="." data-type="text" />
    				<a>
    					<xsl:attribute name="href">
    						javascript:showCategory('<xsl:value-of select="." />')
    					</xsl:attribute>
    					<xsl:attribute name="class">
    					<xsl:choose>
    						<xsl:when test=". = $selected_category">
    							filterSelected
    						</xsl:when>
    						<xsl:otherwise>
    							filter
    						</xsl:otherwise>
    					</xsl:choose>
    					</xsl:attribute>
    					<xsl:value-of select="." />
    				</a>
    
    			</xsl:for-each>
    	</xsl:template>
    	
    	<xsl:template match="movies" mode="normal_view">
    		<xsl:param name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ'" />
    		<xsl:param name="lower" select="'abcdefghijklmnopqrstuvwxyzåäö'" />
    		<table cellspacing="0" class="movieList">
    			<thead>
    				<th>Title</th>
    				<th>Rating</th>
    				<xsl:if test="$show_director = 'true'">
    				<th>Director</th>
    				</xsl:if>
    				<xsl:if test="$show_category = 'true'">
    				<th>Category</th>
    				</xsl:if>
    				<xsl:if test="$show_country = 'true'">
    				<th>Country</th>
    				</xsl:if>
    				<xsl:if test="$show_year = 'true'">
    				<th>Year</th>
    				</xsl:if>
    			</thead>
    			<xsl:choose>
    				<xsl:when test="$search = 'true'">
    					<xsl:apply-templates select="movie[contains(translate(actors, $upper, $lower), $search_string) or 
    														contains(translate(director, $upper, $lower), $search_string) or
    														contains(translate(title, $upper, $lower), $search_string)
    														]" mode="normal_view">
    						<xsl:sort select="*[name() = $sort_by]" order="{$sort_order}" data-type="{$sort_data_type}" />
    					</xsl:apply-templates>
    				</xsl:when>
    				<xsl:otherwise>
    					<xsl:apply-templates select="movie[contains(./category, $selected_category) or $selected_category='All']" mode="normal_view">
    						<xsl:sort select="*[name() = $sort_by]" order="{$sort_order}" data-type="{$sort_data_type}" />
    					</xsl:apply-templates>
    				</xsl:otherwise>
    			</xsl:choose>
    		</table>
    	</xsl:template>
    	
    	<xsl:template match="movie" mode="normal_view">	
    		<tr onmouseover="mouseOverTR(this)" onmouseout="mouseOutTR(this)" class="movieList">
    			<xsl:attribute name="onclick">
    				showMovieInfo(<xsl:value-of select="number" />);
    			</xsl:attribute>
    			<td width="100%" class="movieList">
    				<span class="title" id="col_title">
    				<xsl:number value="position()"/>.
    				<xsl:value-of select="substring-before( title[contains(., '(')], '(' )" />
    				<xsl:value-of select="title[not(contains( ., '(' ))]" />
    				</span>
    			</td>
    			<td class="movieList">
    				[img]images/blank.gif[/img]
    					<xsl:attribute name="style">
    						width: 104px; height: 12px; border: none;
    						filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
    						src='images/<xsl:value-of select="round(rating div 0.5)*0.5" />.png', sizingMethod='scale') 
    					</xsl:attribute>
    				</img>
    			</td>
    			<xsl:if test="$show_director = 'true'">
    				<td class="movieList" >
    					<span id="col_director">
    						<xsl:value-of select="director" />
    					</span>
    				</td>
    			</xsl:if>
    			<xsl:if test="$show_category = 'true'">
    				<td class="movieList">
    					<span id="col_category">
    						<xsl:value-of select="category" />
    					</span>
    				</td>
    			</xsl:if>
    			<xsl:if test="$show_country = 'true'">
    				<td class="movieList">
    					<span id="col_country">
    						<xsl:value-of select="country" />
    					</span>
    				</td>
    			</xsl:if>
    			<xsl:if test="$show_year = 'true'">
    				<td class="movieList">
    					<span id="col_year">
    						<xsl:value-of select="year" />
    					</span>
    				</td>
    			</xsl:if>
    		</tr>
    	</xsl:template>
    	
    	<xsl:template match="movies" mode="info_view">
    		<div class="windowContent">
    		<table class="infoViewTable" height="100%" width="100%" cellpadding="0" cellspacing="0" border="0">
    			<xsl:apply-templates select="movie[number=$movie_number]" mode="info_view" />	
    		</table>
    		</div>
    	</xsl:template>
    	
    	<xsl:template match="movie" mode="info_view">
    		<tr>
    		<td class="infoViewTable" valign="top" width="333">
    			<img class="largePicture">
    				<xsl:attribute name="src">
    					data/<xsl:value-of select="picture" />
    				</xsl:attribute>
    			</img>
    		</td>
    		<td valign="top" class="infoViewTable">
    		<div class="infoViewText">
    			<p class="infoView">
    			<span class="largeTitle">
    				<xsl:value-of select="title" />
    			</span>
    			[img]images/blank.gif[/img]
    				<xsl:attribute name="style">
    					width: 104px; height: 12px; border: none;
    					filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
    					src='images/<xsl:value-of select="round(rating div 0.5)*0.5" />.png', sizingMethod='scale') 
    				</xsl:attribute>
    			</img>
    			</p><p class="infoView">
    			Source:&#160;<xsl:value-of select="source" />
    			<br class="infoViewTable" />
    			 Disks:&#160;<xsl:value-of select="disks" />
    			<br class="infoViewTable" />
    			 Borrower:&#160;<xsl:value-of select="borrower" />			
    			</p><p class="infoView">
    			Category:&#160;<xsl:value-of select="category" />
    			<br class="infoViewTable" />
    			Production:&#160;<xsl:value-of select="country" />,&#160;<xsl:value-of select="year" />
    			<br class="infoViewTable" />
    			Length:&#160;<xsl:value-of select="length" />
    			<br class="infoViewTable" />
    			Director:&#160;<xsl:value-of select="director" />
    			</p><p class="infoView">
    			Description:
    <xsl:value-of select="description" />
    			</p><p class="infoView">
    			Actors:
    
    			<xsl:call-template name="commas_to_br">
    				<xsl:with-param name="src" select="actors" />
    			</xsl:call-template>
    			</p><p class="infoView">
    			Comments:
    <xsl:value-of select="comments" />
    			</p>
    		</div>
    		<p align="right" style="margin-top:10px;padding:0px;">
    		Close window
    		<xsl:if test="$application_type = 'hta'">
    			<a class="button">
    				<xsl:attribute name="href">
    					javascript:showPlayDialog(
    						<xsl:value-of select="number" />,
    						'<xsl:value-of select="media" />'
    					)
    				</xsl:attribute>
    				Play
    			</a>
    		</xsl:if>
    		</p>
    		</td>
    		</tr>
    	</xsl:template>
    	
    	<xsl:template name="commas_to_br">
    		<xsl:param name="src" />
    		<xsl:if test="contains($src, ',')">
    			<xsl:value-of select="substring-before($src, ',')" />
    			
    
    			<xsl:call-template name="commas_to_br">
    				<xsl:with-param name="src" select="substring-after($src, ',')" />
    			</xsl:call-template>
    		</xsl:if>
    	</xsl:template>
       
    	<xsl:template match="category" mode="find_categories">
    		<xsl:call-template name="split_categories">
    			<xsl:with-param name="src" select="." />
    		</xsl:call-template>
    	</xsl:template>
    			
    	<xsl:template name="split_categories">
    		<xsl:param name="src" />
    		<xsl:param name="delimiter" select="'/'" />
    		<xsl:choose>
    			<xsl:when test="contains($src, $delimiter)">
    				<subcategory><xsl:value-of select="normalize-space(substring-before($src, $delimiter))" /></subcategory>
    				<xsl:call-template name="split_categories">
    					<xsl:with-param name="src" select="substring-after($src, $delimiter)" />
    				</xsl:call-template>
    			</xsl:when>
    			<xsl:when test="$src != ''">
    				<subcategory><xsl:value-of select="normalize-space($src)" /></subcategory>
    			</xsl:when>
    		</xsl:choose>
    	</xsl:template>	
    </xsl:stylesheet>
    Grazie

  2. #2
    Il problema è che stai utilizzando la funzione xpath msxsl:node-set, che è proprietaria Microsoft, e quindi funziona solo su Internet Explorer.

    Per una soluzione portabile, dai un'occhiata qui: http://www.exslt.org/exsl/functions/node-set/index.html

    Ciao,

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 © 2025 vBulletin Solutions, Inc. All rights reserved.