Si i dati al database sono settati, ho problemi con la query di inserimento che non è corretta e genera un errore, questo è lo script xslt
Il codice è lungo perchè comprente anche la parte che genera l html, praticamente io devo salvare o dati del file html nel databasecodice:<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sql="org.apache.xalan.lib.sql.XConnection" extension-element-prefixes="sql" > <xsl:param name="driver" select="'com.mysql.jdbc.Driver'"/> <xsl:param name="datasource" select="'jdbc:mysql://127.0.0.1:8888/simple_roadinfo'"/> <xsl:param name="query" select="'INSERT INTO 'simple_roadinfo'.'ricerca_grezza' 'id' , 'owner' , 'secret' , 'server' , 'farm' , 'title' , 'image' VALUES '@id', '@owner', '@secret', '@server', '@farm', '@title', '@image' '"/> <xsl:param name="passwd" select="'passworde del database'"/> <xsl:param name="username" select="'go_select'"/> <xsl:variable name="db" select="sql:new()"/> <xsl:template match="/"> <xsl:if test="not(sql:connect($db, $driver, $datasource, $username, $passwd))" > <xsl:copy-of select="sql:getError($db)/ext-error" /> <xsl:message terminate="yes">Error Connecting to the Database</xsl:message> </xsl:if> <html> <body> <h2>Photos Search</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">IMAGE</th> <th align="left">ID</th> <th align="left">OWNER</th> <th align="left">SECRET</th> <th align="left">SERVER</th> <th align="left">FARM</th> <th align="left">TITLE</th> </tr> <xsl:for-each select="photos/photo"> <tr> <td> <img> <xsl:attribute name="alt"> <xsl:value-of select="@title" /> </xsl:attribute> <xsl:attribute name="src"> <xsl:text>http://farm</xsl:text> <xsl:value-of select="@farm" /> <xsl:text>.static.flickr.com/</xsl:text> <xsl:value-of select="@server" /> <xsl:text>/</xsl:text> <xsl:value-of select="@id" /> <xsl:text>_</xsl:text> <xsl:value-of select="@secret" /> <xsl:text>_t.jpg</xsl:text> </xsl:attribute> </img> </td> <td><xsl:value-of select="@id" /></td> <td><xsl:value-of select="@owner" /></td> <td><xsl:value-of select="@secret" /></td> <td><xsl:value-of select="@server" /></td> <td><xsl:value-of select="@farm" /></td> <td><xsl:value-of select="@title" /></td> </tr> </xsl:for-each> </table> </body> </html> <xsl:value-of select="sql:close($db)"/> </xsl:template> </xsl:stylesheet>
Errore riportato: Message: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: XSLT-param: could not compile select expression ''INSERT INTO 'simple_roadinfo'.'ricerca_grezza' 'id' , 'owner' , 'secret' , 'server' , 'farm' , 'title' , 'image' VALUES '@id', '@owner', '@secret', '@server', '@farm', '@title', '@image' ''.

Rispondi quotando