cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <>
Subject RE: Named queries in SQLTransformer
Date Fri, 11 Nov 2005 08:37:15 GMT
Hello Oleg, 

since you saw your xsl becoming unclear and you did not find an easy way to find where it
went wrong, try to do the following in your xsl:

Using apply-templates instead of for-each. This makes your xsl cleaner and re-use of code
is simple.

So, make your xsl someting like:

<xsl:template match="/">
	    <xsl:apply-templates select="/page/content/sql:rowset[@sql:name='query1']/child::node()"/>

<!-- since child:nodes match to sql:row we need template which matches this, so -->

<xsl:template match="sql:row">
		<xsl:apply-templates select="child::node()"/>

<!-- the child::node() can be any col1....coln in the sql -->

<xsl:template match="sql:col1">
		<xsl:value-of select="."/>
<xsl:template match="sql:col2">
		<xsl:value-of select="."/>

Now, when you only see in the output foo, then your xpath /page/content/sql:rowset[@sql:name='query1']/child::node()
 is not correct. When you see <yi> but not <bar> etc etc....

Just play around with apply-templates, they are very also can include "mode"
for apply-templates to let the template be applied to a specific matcher, etc etc. Better
forget xsl:for-each since you can almost always do withthout. 


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

View raw message