cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luca Morandini" <l.mo...@tin.it>
Subject RE: Cocoon2: Bug in sql transformer? -repost with missing content
Date Wed, 07 Nov 2001 19:19:25 GMT
Perry,
 
 	just thinking aloud... have you tried: <sql:template 
 match="sql:rowset[@sql:name='query1']"> (the difference being in 
 the "sql" namespace-prefix before "name") ?
 
 Best regards,
 
 --------------------------------------------- 
                Luca Morandini 
                GIS Consultant 
               lmorandini@ieee.org 
 http://utenti.tripod.it/lmorandini/index.html 
 ---------------------------------------------
  
 
> > -----Original Message-----
> > From: Perry Tew [mailto:perry_tew@yahoo.com]
> > Sent: Wednesday, November 07, 2001 7:44 PM
> > To: cocoon-users@xml.apache.org; lmorandini@ieee.org
> > Subject: RE: Cocoon2: Bug in sql transformer? -repost with missing
> > content
> > 
> > 
> > Luca,
> > Thanks for your response.
> > 
> > Firse, I'm not really using [@*], I'm using [@*='rowset_name'].  For
> > the sake of posting here, I tried to keep it simple, and testing 
> > [@name] versus [@*] seemed less confusing then testing a boolean
> > condition using both while still illustrating the problem.
> > The reason I'm doing a boolean test on the 'name' attribute is
> > because I have several nested queries in my sql xml file, which
> > creates several rowset elements nested in my tree.  I need to treat
> > each one differently since one is a subtotals query and another is a
> > detail data query, etc.  The name attribute of the rowset element is
> > the only way I can tell them apart.  
> > 
> > Second, I don't want to use [@*='rowset_name'], but whereas
> > [@name='rowset_name'] works with a static xml file and/or from the
> > command line, it doesn't work with an xml stream generated by the sql
> > transformer.
> > 
> > 
> > As you've stated, matching based solely on sql:rowset does work, and
> > quite well, but I was hoping to have several small templates like
> > this:
> > <sql:template match="sql:rowset[@name="query1"]"> ...
> > <sql:template match="sql:rowset[@name="query2"]"> ...
> > <sql:template match="sql:rowset[@name="query3"]"> ...
> > 
> > rather than having one template match on rowset and do a xsl:choose
> > within like this:
> > <sql:template match="sql:rowset">
> >     <xsl:choose>
> >         <xsl:when test="@name='query1'">
> >            etc...
> >         </xsl:when>
> >     </xsl:choose>
> >     etc...
> > </sql:template>
> > 
> > Using several smaller templates seemed much more elegant and easier
> > to manage than one big template.  
> > Of course, I just tried to do the above xsl:choose block, and it
> > wouldn't work either with @name.  Only with "@*='query1'".
> > 
> > The more I work with this, them more I'm convinced this is a bug.  It
> > would really be useful if someone could run a sql query and attempt
> > to transform it based on the name attribute of the rowset.
> > 
> > *** My additional tests ***
> > I also added some additional elements to the sql transformer.  I made
> > my code this:
> > <?xml version="1.0"?>
> > <some_root name="red">
> > <page xmlns:sql="http://apache.org/cocoon/SQL/2.0">
> > 	<execute-query xmlns="http://apache.org/cocoon/SQL/2.0"> 
> > 		<query name="report_date"> SELECT SYSDATE FROM DUAL </query>
> > 	</execute-query>
> > </page>
> > </some_root>
> > 
> > I then added an additional template to my xsl sheet to search for the
> > following match and it worked:
> > 	<xsl:template match="some_root[@name='red']">
> > 		Found a color
> > 		<xsl:apply-templates/>
> > 	</xsl:template>
> > 
> > I'm so confused why my template will match the name attribute on
> > elements I create, but not in the sql:rowset element.  Could this
> > have something to do with namespaces?  I haven't found anything to
> > indicate this possible issue.  And I still can't reconcile how I can
> > save the xml output from a sql transform and it will convert to html
> > correctly, but a straight pipeline won't.
> > 
> > Again, thanks for your response,
> > Perry Tew
> > 
> > 
> > 
> > 
> > --- Luca Morandini <l.moran@tin.it> wrote:
> > > Perry,
> > > 
> > > 	there is a thing I don't understand: why are you using
> > > "sql:rowset[@*]" for
> > > the matching of a rowset ?
> > > 
> > > 	I'm positive "sql:rowset" would work too; moreover, [@*] and
> > > [@name] are,
> > > in my eyes, strange XPath predicates, since a predicate is supposed
> > > to
> > > return a boolean.
> > > 
> > > 	Could you please explain to me why you used them ?
> > > 
> > > Best regards,
> > > 
> > > 
> > > ---------------------------------------------
> > >                Luca Morandini
> > >                GIS Consultant
> > >               lmorandini@ieee.org
> > > http://utenti.tripod.it/lmorandini/index.html
> > > ---------------------------------------------
> > > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Find a job, post your resume.
> > http://careers.yahoo.com

---------------------------------------------------------------------
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