cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <>
Subject RE: Possible to use <xsl:template> in a query?
Date Fri, 10 May 2002 12:52:09 GMT
> From: Hahn Kurt (CHA) []
>  Or would it be better to just execute the query and then aggregate
> result with the XML? I thought it was more elegant to do that through
> 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
> 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
> 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,
> error log said that inserting an <xsl:template> element was not
> 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.


> 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=""
> xmlns:xsl="" >
> <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="">
>       <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. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message