You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Hahn Kurt (CHA)" <ku...@etat.ge.ch> on 2002/05/10 10:55:10 UTC

Possible to use 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">
    <aTag><xsl: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">
      select 	to_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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>