Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202

    [XSLT] inserire tag di chiusura HTML

    Ciao, ho un foglio XSL con due template; in quello principale inizio a definire una tabella

    codice:
    <table>
    <tr>
    dopodichè chiamo il secondo template, all'interno del quale definisco tot celle dopodichè chiudo e riapro la riga

    codice:
    <td>...</td>
    <xsl:if test="hai già messo tot celle">
      </tr><tr>
    </xsl:if>
    Quello che succede è che mi viene detto che non posso piazzare </tr> lì, dato che si aspetta </xsl:if>.
    Ho provato ad usare <xsl:text> e ad usare i codici &lt; e &gt;, ma col primo metodo non cambia nulla mentre col secondo viene bypassato anche l'HTML.

    Come faccio a fargli capire che il tag che sto chiudendo è HTML e non XSL?!

    Grazie...
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  2. #2
    Utente di HTML.it L'avatar di Polley
    Registrato dal
    Jan 2005
    Messaggi
    696
    usa CDATA !!
    comunque se devi fare una tabella con tot righe per numero di celle e nodi fai un ciclo implementando mod


  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    Un esempietto?
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  4. #4
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    Ah ops, c'era proprio l'esempio pari-pari qui

    codice:
    <xsl:if test="position() mod 3 = 0">
                   
                   <script>
                           <![CDATA[document.write("</tr><tr>");]]>
                   </script>
                   
    </xsl:if>
    Ma a me continua a non funzionare... mi scrive proprio sulla pagina HTML </tr><tr>, in pratica bypassa anche l'HTML e diventano normali caratteri anzichè tag!
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  5. #5
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    Ho trovato!

    codice:
    <xsl:if test="number($imgIdx) mod number($nCols) = 0">
    	<xsl:text disable-output-escaping="yes">
    		<![CDATA[ 
    		</tr><tr>
    		 ]]>
    	</xsl:text>
    </xsl:if>
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

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.