You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Vermeulen, Francis" <Fr...@atosorigin.com> on 2002/12/19 16:12:26 UTC

Strange behaviour

Hi,

can anyone tell me why the following xsp statements:

			<xsp:element>
				<xsp:param name="name">
					<xsp:expr>"Category"</xsp:expr>
				</xsp:param>
				<xsp:attribute name="name">
	
<xsp:expr>"Carboxypeptidases"</xsp:expr>
				</xsp:attribute>
				(Generating free amino acids)
			</xsp:element>

Generate this sort of Java code:

>>>>>>>>>>>>

    xspAttr.addAttribute(
      "",
      "name",
      "name",
      "CDATA",
      "\n\t\t\t\t\t" + String.valueOf("Carboxypeptidases") + "\n\t\t\t\t"
    );
  

    this.contentHandler.startElement(
      "",
      
        
        ("Category")
      ,
      
        
        ("Category")
      ,
      xspAttr
    );

    xspAttr.clear();

    
        this.characters("\n\t\t\t\t");
      
        this.characters("\n\t\t\t\t");
      
        this.characters("\n\t\t\t\t(Generating free amino acids)");
      
        this.characters("\n\t\t\t");
      

    this.contentHandler.endElement(
      "",
      
        
        ("Category")
      ,
      
        
        ("Category")
      );

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

The problem here is in the "xspAttr.addAttribute()" call that these strings
"\n\t\t\t\t\t" are being appended to "String.valueOf("Carboxypeptidases")",
which is obviously not what I intended. To bypass this problem, I'm forced
to add the correct Java code directly into the xsp file, eg:

 xspAttr.addAttribute(
      "",
      "name",
      "name",
      "CDATA",
      String.valueOf("Carboxypeptidases")
    );

This behaviour is however not consistent, in some other xsp files the
correct code is generated. I've been looking at the xsp: stylesheet, but
cannot find an explanation for this behaviour.

Regards,
Francis

============================================
Ing. FRA Vermeulen
Senior J2EE Architect
ECM Solutions - Eindhoven
mobiel: +31 (0) 6 222 03 856
e-mail: francis.vermeulen@atosorigin.com
============================================



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Strange behaviour

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
This is one of the things that will be corrected or enhanced in the next
version of cocoon. "remove of spaces chars".

For now you can work around:
<xsp:param name="name"><xsp:expr>"Category"</xsp:expr></xsp:param>
<xsp:attribute
name="name"><xsp:expr>"Carboxypeptidases"</xsp:expr></xsp:attribute>

or try to use the xsl function normalize-space() in a stylesheet.

Antonio Gallardo


Vermeulen, Francis dijo:
> Hi,
>
> can anyone tell me why the following xsp statements:
>
> 			<xsp:element>
> 				<xsp:param name="name">
> 					<xsp:expr>"Category"</xsp:expr>
> 				</xsp:param>
> 				<xsp:attribute name="name">
>
> <xsp:expr>"Carboxypeptidases"</xsp:expr>
> 				</xsp:attribute>
> 				(Generating free amino acids)
> 			</xsp:element>
>
> Generate this sort of Java code:
>
>>>>>>>>>>>>>
>
>     xspAttr.addAttribute(
>       "",
>       "name",
>       "name",
>       "CDATA",
>       "\n\t\t\t\t\t" + String.valueOf("Carboxypeptidases") +
> "\n\t\t\t\t"
>     );
>
>
>     this.contentHandler.startElement(
>       "",
>
>
>         ("Category")
>       ,
>
>
>         ("Category")
>       ,
>       xspAttr
>     );
>
>     xspAttr.clear();
>
>
>         this.characters("\n\t\t\t\t");
>
>         this.characters("\n\t\t\t\t");
>
>         this.characters("\n\t\t\t\t(Generating free amino acids)");
>
>         this.characters("\n\t\t\t");
>
>
>     this.contentHandler.endElement(
>       "",
>
>
>         ("Category")
>       ,
>
>
>         ("Category")
>       );
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> The problem here is in the "xspAttr.addAttribute()" call that these
> strings "\n\t\t\t\t\t" are being appended to
> "String.valueOf("Carboxypeptidases")", which is obviously not what I
> intended. To bypass this problem, I'm forced to add the correct Java
> code directly into the xsp file, eg:
>
>  xspAttr.addAttribute(
>       "",
>       "name",
>       "name",
>       "CDATA",
>       String.valueOf("Carboxypeptidases")
>     );
>
> This behaviour is however not consistent, in some other xsp files the
> correct code is generated. I've been looking at the xsp: stylesheet, but
> cannot find an explanation for this behaviour.
>
> Regards,
> Francis
>
> ============================================
> Ing. FRA Vermeulen
> Senior J2EE Architect
> ECM Solutions - Eindhoven
> mobiel: +31 (0) 6 222 03 856
> e-mail: francis.vermeulen@atosorigin.com
> ============================================
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>