cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hahn Kurt (CHA)" <kurt.h...@etat.ge.ch>
Subject RE: Possible to use <xsl:template> in a query?
Date Fri, 10 May 2002 09:07:11 GMT
 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: 'cocoon-users@xml.apache.org'
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">
    <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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message