RE: Possible to use xsl:template in a query?
Or would it be better to just execute the query and then aggregate the result with the XML? I thought it was more elegant to do that through an XSL... -Message d'origine- De: Hahn Kurt (CHA) A: '[EMAIL PROTECTED]' Date: 10.05.02 10:55 Objet: Possible to use xsl:template in a query? The stylesheet below is applied to use a parameter (=odjID) with a query. It is actually applied to a dummy XML, which contains no data (this pattern works just the way I want it). The correponding sitemap entry looks like this: map:generate src=Queries/raw-query.xml/ map:transform src=Queries/odj_query.xsl (=The stylesheet below) map:parameter name=var value={1}/ /map:transform map:transform type=sql. Now I'd like to use the same pattern for something else, and this time, the XML (raw-query above) would contain data I'd like to keep. The problem is that wherever in the XSL I insert something like this: xsl:template match=sql:enTete aTagxsl:value-of select=.//aTag /xsl:template I'm getting a NullPointerException error from Cocoon. At one point, the error log said that inserting an xsl:template element was not allowed here, but moving it around in the XSL didn't help. How can I add the information from the XML then? Here's the styleheet, it works perfectly as long as I don't wanna add another xsl:template section... xsl:stylesheet version=1.0 xmlns:sql=http://apache.org/cocoon/SQL/2.0; xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xsl:param name=var/ xsl:template match=/ xsl:variable name=odjID xsl:value-of select=$var/ xsl:apply-templates select=sql:enTete/ /xsl:variable page content execute-query xmlns=http://apache.org/cocoon/SQL/2.0; query name=titreOJ_séance selectto_char(RE.REU_DATE) as reu_dateReunion, to_char(RE.REU_HDEBUT,'hh24:mi') as reu_heureReunion from REUNION RE where RE.OBJ_ID = xsl:value-of select=$odjID/ /query /execute-query /content /page /xsl:template /xsl:stylesheet - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Possible to use xsl:template in a query?
From: Hahn Kurt (CHA) [mailto:[EMAIL PROTECTED]] Or would it be better to just execute the query and then aggregate the result with the XML? I thought it was more elegant to do that through an XSL... ... The stylesheet below is applied to use a parameter (=odjID) with a query. It is actually applied to a dummy XML, which contains no data (this pattern works just the way I want it). The correponding sitemap entry looks like this: map:generate src=Queries/raw-query.xml/ map:transform src=Queries/odj_query.xsl (=The stylesheet below) map:parameter name=var value={1}/ /map:transform map:transform type=sql. Now I'd like to use the same pattern for something else, and this time, the XML (raw-query above) would contain data I'd like to keep. The problem is that wherever in the XSL I insert something like this: xsl:template match=sql:enTete aTagxsl:value-of select=.//aTag /xsl:template I'm getting a NullPointerException error from Cocoon. At one point, the error log said that inserting an xsl:template element was not allowed here, but moving it around in the XSL didn't help. How can I add the information from the XML then? Looks like you have made an error while adding xsl:template, and stylesheet became invalid. Do this: save your XML before it has been processed by your XSLT into file, and use command-line Xalan to process it with the stylesheet. Now edit stylesheet as you want, and test with Xalan. When you have desired result, plug it into Cocoon. Vadim Here's the styleheet, it works perfectly as long as I don't wanna add another xsl:template section... xsl:stylesheet version=1.0 xmlns:sql=http://apache.org/cocoon/SQL/2.0; xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xsl:param name=var/ xsl:template match=/ xsl:variable name=odjID xsl:value-of select=$var/ xsl:apply-templates select=sql:enTete/ /xsl:variable page content execute-query xmlns=http://apache.org/cocoon/SQL/2.0; query name=titreOJ_séance select to_char(RE.REU_DATE) as reu_dateReunion, to_char(RE.REU_HDEBUT,'hh24:mi') as reu_heureReunion fromREUNION RE where RE.OBJ_ID = xsl:value-of select=$odjID/ /query /execute-query /content /page /xsl:template /xsl:stylesheet - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]