Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it L'avatar di LA VALE
    Registrato dal
    Sep 2003
    Messaggi
    667

    xml+xsl come asp/php+database

    forse dal titolo nn si capisce molto, cmq è possibile creare una pagina XSL che rikiama una XML da usare come database? mi spiego:
    è possibile con una pagina XSL chiamare una per volta le "informazioni" (brevi testi, news ecc) contenute in una pagina XML, con i relativi links per avanzare e tornare indietro alla precedente/successiva "informazione"?
    cioè che si compporti come una pagina asp/php che rikiede informazioni a un database...

    grazie ciao

  2. #2
    Piu' o meno. Devi pero' usare qualche linguaggio di scripting per passare i dati via query al file XSL, e' il solo modo per passare delle variabili.
    Are you alive?
    No, but I was written with LOVE. A new scripting language.
    www.frequenze.it

  3. #3
    Utente di HTML.it L'avatar di LA VALE
    Registrato dal
    Sep 2003
    Messaggi
    667
    puoi farmi un piccolo esempio??? così lo provo...
    grazie...

  4. #4
    Are you alive?
    No, but I was written with LOVE. A new scripting language.
    www.frequenze.it

  5. #5
    Utente di HTML.it L'avatar di LA VALE
    Registrato dal
    Sep 2003
    Messaggi
    667
    grazie mille!!!!

    peccato ke si debba usare asp

    provo a kiedere se è possibile trasformare tutto in php...


  6. #6
    Utente di HTML.it L'avatar di LA VALE
    Registrato dal
    Sep 2003
    Messaggi
    667
    allora aiuto!!!!

    ho copiato il codice da un tutorial d webaiuto ma nn funziona...

    pagina xml:

    <listaprodotti>
    <prodotto id="1" nome="Sum41 - Does this look infected">Ultimo album del famoso gruppo punk-rock
    </prodotto>
    <prodotto id="2" nome="Iron Maiden - The best of the beast">Album fantastico!
    </prodotto>
    </listaprodotti>

    pagina xsl (oppure xslt - ho provato entrambe le estensioni)

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xslaram name="id"/>

    <xslutput method="xhtml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" version="1.0" indent="yes" encoding="iso-8859-1"/>

    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>
    Sistema di visualizzazione dei prodotti
    </title>
    </head>

    <body>
    <xsl:choose>
    <xsl:when test="$id!=''">



    <xsl:call-template name="vediprodotto">
    <xsl:with-param name="id"/>
    </xsl:call-template>
    </xsl:when>
    <xsltherwise>



    <xsl:call-template name="elenca" />
    </xsltherwise>
    </xsl:choose>
    </body>
    </html>
    </xsl:template>


    <xsl:template name="elenca">

    <xsl:for-each select="//prodotto">#<xsl:value-of select="@id"/> - <xsl:value-of select="@nome"/>

    </xsl:for-each>
    </xsl:template>


    <xsl:template name="vediprodotto">
    #<xsl:value-of select="listaprodotti/prodotto[@id=$id]/@id"/> - <xsl:value-of select="listaprodotti/prodotto[@id=$id]/@nome"/>

    <blockquote>
    <xsl:value-of select="listaprodotti/prodotto[@id=$id]/."/>
    </blockquote>
    </xsl:template>
    </xsl:stylesheet>


    pagina asp:

    <%
    'Ricevo l'id
    iID = Request.Querystring("id")

    'Creo l'oggetto XML
    Set objXML = Server.CreateObject("Msxml2.DOMDocument.4.0")

    'Carico i dati XML
    objXML.async = FalseobjXML.load("esempio.xml")

    'Creo gli oggetti per il foglio di stile
    set objXSL = Server.CreateObject("MSXML2.FreeThreadedDOMDocumen t.4.0")
    set xslTemplate = Server.CreateObject("MSXML2.XSLTemplate.4.0")

    'Carico il foglio di stile
    objXSL.async = False
    objXSL.load("esempio.xslt")

    'Passo il parametro
    xslTemplate.stylesheet = objXSLset
    xslProcessor = xslTemplate.createProcessor()
    xslProcessor.addParameter "id", iID

    'Eseguo la trasformazione
    xslProcessor.input = objXML
    xslProcessor.transform()
    Response.Write(xslProcessor.output)

    'Pulizia
    set xslProcessor = nothingset
    objXSL = nothing
    set xslTemplate = nothing
    Set objXML = nothing
    %>


    il link è questo: http://a.domaindlx.com/lv4er/esempio.asp

    come vedete nn funziona: AIUTO!!!

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.