You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Laura Kruse <lm...@cis.ksu.edu> on 2000/04/22 05:12:37 UTC

skipping stylesheet comments

Ok, does cocoon automatically skip the comments in a stylesheet and not
put them in the generated output?

The reason I'm asking is because I want to include a script that will
take the results of my SQL Query and put them into two comboboxes in
which the second one is based on the selection in the first.  But if I
comment out the script like you'd do in static html it seems to skip the
processing of the script itself, and it will never appear in the
generated html.  

But if I uncomment it, it complains about 'for(i=0;i<groups;i++)' and
that 'Element type "groups" must be followed by either attribute
specifications, ">" or "/>".'  But groups is just some variable I
declared earlier in my script.  I put the script in a static html page
it runs fine, but my entire goal was that I can't hardcode the items in
the combobox because they change as the database changes so if I can
make an automatically generating page that means less work for me. 
Basically I want to be lazy. :)

Is there some special tag that I need to be using to make this work, or
am I just trying to do something that is beyond the scope of cocoon at
this time?

	- Laura

Re: skipping stylesheet comments

Posted by Stefano Mazzocchi <st...@apache.org>.
Laura Kruse wrote:
> 
> Ok, does cocoon automatically skip the comments in a stylesheet and not
> put them in the generated output?

no, it's not Cocoon, it's the XSLT processor. And yes, this is the
default behavior.
 
> The reason I'm asking is because I want to include a script that will
> take the results of my SQL Query and put them into two comboboxes in
> which the second one is based on the selection in the first.  But if I
> comment out the script like you'd do in static html it seems to skip the
> processing of the script itself, and it will never appear in the
> generated html.  
> 
> But if I uncomment it, it complains about 'for(i=0;i<groups;i++)' and
> that 'Element type "groups" must be followed by either attribute
> specifications, ">" or "/>".'  But groups is just some variable I
> declared earlier in my script.  

this should fix your problem:

<xsl:template match="comment()">
 <xsl:copy>
  <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: skipping stylesheet comments

Posted by Brett McLaughlin <ne...@gte.net>.

Laura Kruse wrote:
> 
> Ok, does cocoon automatically skip the comments in a stylesheet and not
> put them in the generated output?
> 
> The reason I'm asking is because I want to include a script that will
> take the results of my SQL Query and put them into two comboboxes in
> which the second one is based on the selection in the first.  But if I
> comment out the script like you'd do in static html it seems to skip the
> processing of the script itself, and it will never appear in the
> generated html.  
> 
> But if I uncomment it, it complains about 'for(i=0;i<groups;i++)' and
> that 'Element type "groups" must be followed by either attribute
> specifications, ">" or "/>".'  But groups is just some variable I
> declared earlier in my script.  

for (i=0;i&lt;groups;i++)

remember '<' is an XML character.

-Brett