Visualizzazione dei risultati da 1 a 6 su 6

Discussione: [XSL] Include

  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2000
    Messaggi
    66

    [XSL] Include

    Vi prego aiutatemi

    Ho urgente bisogno di usare l'include di xsl, ma nn riesco a farlo funzionare in nessun modo.
    Nemmeno con gli esempi più banali presi da qualche guida in rete

    Come devo fare?
    Se avete degli esempi funzionanti postateli che li provo.




    Io ho provato così:

    Il file .xsl principale contiene:
    codice:
    <?xml version="1.0" encoding="ISO8859-1"?>
    <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">	
    
        <xsl:include href="Template1.xsl" />
    
        <xsl:template match="/">
            
            Homepage
    
            <xsl:call-template name="Content" />        
            
        </xsl:template>
      
    </xsl:stylesheet>


    Template1.xsl contiene:
    codice:
    <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">	
        
        <xsl:template name="Content">
            Content of the page goes here
        </xsl:template>
        
    </xsl:stylesheet>

    Non c'è nessun problema di percorso perchè valido tramite NetBeans e se il percorso dei file fosse sbagliato lo segnala.

  2. #2
    Utente di HTML.it
    Registrato dal
    Nov 2000
    Messaggi
    66
    up

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2000
    Messaggi
    66
    Scusate, dunque ho fatto altre prove, ma nulla, spiego meglio:




    Io ho provato così:


    File Xsl Principale:
    codice:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:output method="html"/>
        <xsl:include href="include1.xsl"/>    
        <xsl:template match="/">
            <html><body>          
                Homepage
    
                <xsl:call-template name="album"/>                      
            </body></html>
        </xsl:template>
    </xsl:stylesheet>

    File include1.xsl:
    codice:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">    
        <xsl:output method="html"/>
        <xsl:template name="album">
            BLA BLA                                
        </xsl:template>
    </xsl:stylesheet>

    Tutto ciò richiamato dalla JSP:
    codice:
    <%@ page contentType="text/html" %>
    <%@ page session="true" %>
    <%@ page buffer="30kb" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    
    <c:set var="xmlDocument" scope="page">
        <ROOT></ROOT>
    </c:set>
    
    <x:parse xml="${xmlDocument}" var="xml"/>
    
    <c:set var="xslUrl"><%="/XSL/ITA/Esempio3.xsl"%></c:set>
    <c:import var="xslDocument" url="${xslUrl}" scope="page"/>
    <x:parse xml="${xslDocument}" var="xsl"/>
    
    <x:transform xml="${xml}" xslt="${xsl}"/>





    Ho provato ad utilizzare un tool di NetBeans, XSL Trasformations che genera un
    output dato un file .xml e il tutto funziona correttamente.
    Ho provato a prendere tutto il template name="album" e metterlo nel xsl
    principale, richiamato sempre da <xsl:call-template name="album"/> e funziona.

    Dunque pare che l'inclusione non avviene e fallisce l'istruzione
    <xsl:call-template name="album"/>

    Infatti il Tomcat segnala questi errori:
    ERRORE: 'Maschera 'album' non definita in questo foglio di stile. '
    ERRORE GRAVE: 'Impossibile compilare il foglio di stile '


    Ma il percorso di inclusione è corretto, di fatti se lo cambio e faccio la
    validazione con netbeans, lui mi segnala file non trovato, e in ogni caso ho
    provato le varie possibili combinazioni di percorso....

  4. #4
    Utente di HTML.it
    Registrato dal
    Nov 2000
    Messaggi
    66
    Cmq alla fine ho risolto.
    Le guide non lo dicono ma il percorso del file da includere deve essere specificato per forza assoluto e comprensivo di protocollo.

  5. #5
    ciao zaelos grazie di avermi risposto, scusa la mia ignoranza ma sò come muovermi per risolvere il mio problema.
    Vediamo se puoi darmi una mano.
    ti invio la pagina da tradurre.
    <?xml version="1.0" encoding="utf-8" ?>
    - <template background="p_bg_slots" x="500" y="20" gid="1" gname="Single Player American Roulette" stype="" sname="" tableid="">
    <mpsprite spriteid="p_1_00" index="100" image="img\gc_preview_1_00.jpg" mask="" columns="1" rows="1" frames="1" />
    <cell left="3" top="3" right="297" bottom="172" bcolor="#000000" background="p_1_00" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#FFFFFF" framewidth="1" />
    <button itemid="btnPreInit" itemcode="1" gameid="1" subtype="" parentid="0" x="3" y="176" visible="1" state="1" spriteid="p_btn_Status" cursorid="0" frame="0" stateid="stPreInit" />
    <button itemid="btnInstall" itemcode="2" gameid="1" subtype="" parentid="0" x="3" y="176" visible="1" state="2" spriteid="p_btn_Status" cursorid="0" frame="0" stateid="stDownload" />
    <button itemid="btnDownloading" itemcode="3" gameid="1" subtype="" parentid="0" x="3" y="176" visible="1" state="1" spriteid="p_btn_Status" cursorid="0" frame="0" stateid="stDownloading" />
    <button itemid="btnRestart" itemcode="4" gameid="1" subtype="" parentid="0" x="3" y="176" visible="1" state="2" spriteid="p_btn_Status" cursorid="0" frame="0" stateid="stRestart" />
    <button itemid="btnPlay" itemcode="5" gameid="1" subtype="" parentid="0" x="3" y="176" visible="1" state="2" spriteid="p_btn_Status" cursorid="0" frame="0" stateid="stPlay" />
    <progressbar left="128" top="183" right="287" bottom="193" spriteid="p_downloading_progress" />
    <cell left="5" top="205" right="207" bottom="224" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Zero</cell>
    <cell left="209" top="205" right="294" bottom="224" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">0 e 00</cell>
    <cell left="5" top="226" right="207" bottom="245" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Puntata</cell>
    <cell left="209" top="226" right="294" bottom="245" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Vincita</cell>
    <cell left="5" top="247" right="207" bottom="266" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Scala, 1 numero</cell>
    <cell left="209" top="247" right="294" bottom="266" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">da 35 a 1</cell>
    <cell left="5" top="268" right="207" bottom="287" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Dividi, 2 numeri</cell>
    <cell left="209" top="268" right="294" bottom="287" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">da 17 a 1</cell>
    <cell left="5" top="289" right="207" bottom="308" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Strada, 3 numeri</cell>
    <cell left="209" top="289" right="294" bottom="308" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">da 11 a 1</cell>
    <cell left="5" top="310" right="207" bottom="329" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Angolo, 4 numeri</cell>
    <cell left="209" top="310" right="294" bottom="329" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">da 8 a 1</cell>
    <cell left="5" top="331" right="207" bottom="350" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Cesto, 5 numeri</cell>
    <cell left="209" top="331" right="294" bottom="350" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">da 6 a 1</cell>
    <cell left="5" top="352" right="207" bottom="371" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Riga, 6 numeri</cell>
    <cell left="209" top="352" right="294" bottom="371" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">da 5 a 1</cell>
    <cell left="5" top="373" right="207" bottom="392" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">Colonna/Dozzina, 12 numeri</cell>
    <cell left="209" top="373" right="294" bottom="392" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">da 2 a 1</cell>
    <cell left="5" top="394" right="207" bottom="413" bcolor="#EFD6AC" multiline="N" fontid="fntTitleText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">18 numeri</cell>
    <cell left="209" top="394" right="294" bottom="413" bcolor="#1B1A15" multiline="N" fontid="fntCellText" lmargin="2" tmargin="0" framecolor="#EFD6AC" framewidth="1">da 1 a 1</cell>
    </template>

  6. #6
    scusami ancora volevo dirti che non sò come muovermi ti ringrazio anticipatamente

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.