You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bas Passon <BP...@parite.nl> on 2000/10/23 10:44:27 UTC

formating problems

I'm having problems when generating source code with the help of cocoon.

Consider the following sample:

		<column name="id">
			<type value="INTEGER"/>
			<null value="false"/>
			<autoincr value="true"/>
			<size value="10"/>
			<reference table="table" column="c1"/>
			<default value="0"/>
			<check mode="greater" value="10"/>
		</column>

A piece from the xsl-stylesheet

	.....
		<xsl:for-each select="column">
		public <xsl:apply-templates select="type"/> get<xsl:value-of
select="@name"/>
		{
			return null;
		}
		</xsl:for-each>
	.....

together with this style template for the type:

	<xsl:template match="type">
      	<xsl:variable name="type" select="@value"/>
		<xsl:choose>
			<xsl:when test='$type="INTEGER"'>
				Integer
			</xsl:when>
			<xsl:otherwise>
				String
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>	

It generates this:

                public
                        Integer
                 getid
                {
                        return null;
                }

What i would like it to do is generate this:

		public Integer getid
		{
			return null;
		}

Is there some way to make cocoon do this the way i would like it?

thnx

Bas


Re: Re: formating problems

Posted by Konstantin Piroumian <KP...@flagship.ru>.
Sorry.
I only replied in the format that the original letter was sent.

I said, that everything seems to be correct with XSL.
And maybe the context where it used is not correct (column element can be
not accessible in the place where the <xsl:for-each...> is used).

Regards,
  Kot.


----- Original Message -----
From: "Aurélien DEHAY" <au...@sncf.fr>
To: <co...@xml.apache.org>
Sent: 23 ??????? 2000 ?., ??????????? 13:06
Subject: Re: Re: formating problems


"Konstantin Piroumian" <KP...@flagship.ru> writes:

I think you should do something for this. Maybe post in text.

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD><TITLE>formating problems</TITLE>
>
> <META content="MSHTML 5.50.4134.600" name=GENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=#d8d0c8>
> <DIV><FONT size=2>It seems that everything is correct with your XSL and it
must
> work.</FONT></DIV>
> <DIV><FONT size=2>Check the context where you use &lt;xsl:for-each
> ...&gt;</FONT></DIV>
> <DIV><FONT size=2>Maybe the column is not accesible from
there.</FONT></DIV>
> <DIV><FONT size=2></FONT>&nbsp;</DIV>
> <DIV><FONT size=2>Just a suggestion.</FONT></DIV>
> <DIV><FONT size=2></FONT>&nbsp;</DIV>
> <DIV><FONT size=2>Regards, </FONT></DIV>
> <DIV><FONT size=2>&nbsp; Kot.</FONT></DIV>
> <BLOCKQUOTE dir=ltr
> style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px;
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
>   <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
>   <DIV
>   style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color:
black"><B>From:</B>
>   <A title=BPasson@parite.nl href="mailto:BPasson@parite.nl">Bas
Passon</A>
>   </DIV>
>   <DIV style="FONT: 10pt arial"><B>To:</B> <A
title=cocoon-users@xml.apache.org
>   href="mailto:cocoon-users@xml.apache.org">Cocoon Mailinglist
(E-mail)</A>
>   </DIV>
>   <DIV style="FONT: 10pt arial"><B>Sent:</B> 23
&#1086;&#1082;&#1090;&#1103;&#1073;&#1088;&#1103; 2000 &#1075;.,
&#1087;&#1086;&#1085;&#1077;&#1076;&#1077;&#1083;&#1100;&#1085;&#1080;&#1082
;
>   12:44</DIV>
>   <DIV style="FONT: 10pt arial"><B>Subject:</B> formating problems</DIV>
>   <DIV><FONT size=2></FONT><FONT size=2></FONT><FONT size=2></FONT><FONT
>   size=2></FONT><BR></DIV>
>   <P><FONT size=2>I'm having problems when generating source code with the
help
>   of cocoon.</FONT> </P>
>   <P><FONT size=2>Consider the following sample:</FONT> </P>
>   <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;column
>   name="id"&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;type
>   value="INTEGER"/&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;null
>   value="false"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;autoincr
>   value="true"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;size
>   value="10"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;reference
>   table="table" column="c1"/&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;default
>   value="0"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;check
>   mode="greater" value="10"/&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
size=2>&lt;/column&gt;</FONT>
>   </P>
>   <P><FONT size=2>A piece from the xsl-stylesheet</FONT> </P>
>   <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>.....</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;xsl:for-each
>   select="column"&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>public
>   &lt;xsl:apply-templates select="type"/&gt; get&lt;xsl:value-of
>   select="@name"/&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>{</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>return
null;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>}</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
>   size=2>&lt;/xsl:for-each&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>.....</FONT>
</P>
>   <P><FONT size=2>together with this style template for the type:</FONT>
</P>
>   <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
size=2>&lt;xsl:template
>   match="type"&gt;</FONT> <BR><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;
>   &lt;xsl:variable name="type" select="@value"/&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
>   size=2>&lt;xsl:choose&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;xsl:when
>   test='$type="INTEGER"'&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>Integer</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
>   size=2>&lt;/xsl:when&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
>   size=2>&lt;xsl:otherwise&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>String</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
>   size=2>&lt;/xsl:otherwise&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
>   size=2>&lt;/xsl:choose&gt;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT
>   size=2>&lt;/xsl:template&gt; </FONT></P>
>   <P><FONT size=2>It generates this:</FONT> </P>
>   <P><FONT
>
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;
>   public</FONT> <BR><FONT
>
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   Integer</FONT> <BR><FONT
>
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;
>   getid</FONT> <BR><FONT
>
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;
>   {</FONT> <BR><FONT
>
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   return null;</FONT> <BR><FONT
>
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;
>   }</FONT> </P>
>   <P><FONT size=2>What i would like it to do is generate this:</FONT> </P>
>   <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>public Integer
>   getid</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>{</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>return
null;</FONT>
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>}</FONT> </P>
>   <P><FONT size=2>Is there some way to make cocoon do this the way i would
like
>   it?</FONT> </P>
>   <P><FONT size=2>thnx</FONT> </P>
>   <P><FONT size=2>Bas</FONT> </P></BLOCKQUOTE></BODY></HTML>

--
Aurélien

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org



Re: Re: formating problems

Posted by Aurélien DEHAY <au...@sncf.fr>.
"Konstantin Piroumian" <KP...@flagship.ru> writes:

I think you should do something for this. Maybe post in text.

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD><TITLE>formating problems</TITLE>
> 
> <META content="MSHTML 5.50.4134.600" name=GENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=#d8d0c8>
> <DIV><FONT size=2>It seems that everything is correct with your XSL and it must 
> work.</FONT></DIV>
> <DIV><FONT size=2>Check the context where you use &lt;xsl:for-each 
> ...&gt;</FONT></DIV>
> <DIV><FONT size=2>Maybe the column is not accesible from there.</FONT></DIV>
> <DIV><FONT size=2></FONT>&nbsp;</DIV>
> <DIV><FONT size=2>Just a suggestion.</FONT></DIV>
> <DIV><FONT size=2></FONT>&nbsp;</DIV>
> <DIV><FONT size=2>Regards, </FONT></DIV>
> <DIV><FONT size=2>&nbsp; Kot.</FONT></DIV>
> <BLOCKQUOTE dir=ltr 
> style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
>   <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
>   <DIV 
>   style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
>   <A title=BPasson@parite.nl href="mailto:BPasson@parite.nl">Bas Passon</A> 
>   </DIV>
>   <DIV style="FONT: 10pt arial"><B>To:</B> <A title=cocoon-users@xml.apache.org 
>   href="mailto:cocoon-users@xml.apache.org">Cocoon Mailinglist (E-mail)</A> 
>   </DIV>
>   <DIV style="FONT: 10pt arial"><B>Sent:</B> 23 &#1086;&#1082;&#1090;&#1103;&#1073;&#1088;&#1103; 2000 &#1075;., &#1087;&#1086;&#1085;&#1077;&#1076;&#1077;&#1083;&#1100;&#1085;&#1080;&#1082; 
>   12:44</DIV>
>   <DIV style="FONT: 10pt arial"><B>Subject:</B> formating problems</DIV>
>   <DIV><FONT size=2></FONT><FONT size=2></FONT><FONT size=2></FONT><FONT 
>   size=2></FONT><BR></DIV>
>   <P><FONT size=2>I'm having problems when generating source code with the help 
>   of cocoon.</FONT> </P>
>   <P><FONT size=2>Consider the following sample:</FONT> </P>
>   <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;column 
>   name="id"&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;type 
>   value="INTEGER"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;null 
>   value="false"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;autoincr 
>   value="true"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;size 
>   value="10"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;reference 
>   table="table" column="c1"/&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;default 
>   value="0"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;check 
>   mode="greater" value="10"/&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;/column&gt;</FONT> 
>   </P>
>   <P><FONT size=2>A piece from the xsl-stylesheet</FONT> </P>
>   <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>.....</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;xsl:for-each 
>   select="column"&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>public 
>   &lt;xsl:apply-templates select="type"/&gt; get&lt;xsl:value-of 
>   select="@name"/&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>{</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>return null;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>}</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
>   size=2>&lt;/xsl:for-each&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>.....</FONT> </P>
>   <P><FONT size=2>together with this style template for the type:</FONT> </P>
>   <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;xsl:template 
>   match="type"&gt;</FONT> <BR><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 
>   &lt;xsl:variable name="type" select="@value"/&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
>   size=2>&lt;xsl:choose&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>&lt;xsl:when 
>   test='$type="INTEGER"'&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>Integer</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
>   size=2>&lt;/xsl:when&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
>   size=2>&lt;xsl:otherwise&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>String</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
>   size=2>&lt;/xsl:otherwise&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
>   size=2>&lt;/xsl:choose&gt;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
>   size=2>&lt;/xsl:template&gt; </FONT></P>
>   <P><FONT size=2>It generates this:</FONT> </P>
>   <P><FONT 
>   size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   public</FONT> <BR><FONT 
>   size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   Integer</FONT> <BR><FONT 
>   size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   getid</FONT> <BR><FONT 
>   size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   {</FONT> <BR><FONT 
>   size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   return null;</FONT> <BR><FONT 
>   size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   }</FONT> </P>
>   <P><FONT size=2>What i would like it to do is generate this:</FONT> </P>
>   <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>public Integer 
>   getid</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>{</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>return null;</FONT> 
>   <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>}</FONT> </P>
>   <P><FONT size=2>Is there some way to make cocoon do this the way i would like 
>   it?</FONT> </P>
>   <P><FONT size=2>thnx</FONT> </P>
>   <P><FONT size=2>Bas</FONT> </P></BLOCKQUOTE></BODY></HTML>

-- 
Aurélien

Re: formating problems

Posted by Konstantin Piroumian <KP...@flagship.ru>.
formating problemsIt seems that everything is correct with your XSL and it must work.
Check the context where you use <xsl:for-each ...>
Maybe the column is not accesible from there.

Just a suggestion.

Regards, 
  Kot.
  ----- Original Message ----- 
  From: Bas Passon 
  To: Cocoon Mailinglist (E-mail) 
  Sent: 23 ??????? 2000 ?., ??????????? 12:44
  Subject: formating problems


  I'm having problems when generating source code with the help of cocoon. 

  Consider the following sample: 

                  <column name="id"> 
                          <type value="INTEGER"/> 
                          <null value="false"/> 
                          <autoincr value="true"/> 
                          <size value="10"/> 
                          <reference table="table" column="c1"/> 
                          <default value="0"/> 
                          <check mode="greater" value="10"/> 
                  </column> 

  A piece from the xsl-stylesheet 

          ..... 
                  <xsl:for-each select="column"> 
                  public <xsl:apply-templates select="type"/> get<xsl:value-of select="@name"/> 
                  { 
                          return null; 
                  } 
                  </xsl:for-each> 
          ..... 

  together with this style template for the type: 

          <xsl:template match="type"> 
          <xsl:variable name="type" select="@value"/> 
                  <xsl:choose> 
                          <xsl:when test='$type="INTEGER"'> 
                                  Integer 
                          </xsl:when> 
                          <xsl:otherwise> 
                                  String 
                          </xsl:otherwise> 
                  </xsl:choose> 
          </xsl:template> 

  It generates this: 

                  public 
                          Integer 
                   getid 
                  { 
                          return null; 
                  } 

  What i would like it to do is generate this: 

                  public Integer getid 
                  { 
                          return null; 
                  } 

  Is there some way to make cocoon do this the way i would like it? 

  thnx 

  Bas