cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wouter Heijke <whei...@agency.com>
Subject RE: Added spaces with xsp:attribute
Date Tue, 06 Feb 2001 14:22:15 GMT
It smells like a bug to me :-)

But this is a quick workaround:

	<xsp:attribute
name="badcustomid"><xsp:expr>val</xsp:expr></xsp:attribute>

It seems to work.
The problem is in 'xsp-java.xsl' where the \n and \t formatting characters
are not stripped from the <xsp:expr> tags.
Here is a piece of the generated (buggy) java code:

    ((Element) xspCurrentNode).setAttribute(
      "badcustomid",
      
	    "\n\t\t\t\t"
	  
	
	+
      
	    String.valueOf(val)
	  
	
	+
      
	    "\n\t\t\t"
	  
	
	+
      
      ""
    ); 

Somehow xsp:text java code is generated by xsp-java.xsl stylesheet!

BTW using <xsp:text> gives the same problem, added spaces!

Wouter


-----Original Message-----
From: Robin Green [mailto:greenrd@hotmail.com]
Sent: Monday, February 05, 2001 19:30
To: cocoon-users@xml.apache.org
Cc: wheijke@agency.com
Subject: Re: Added spaces with xsp:attribute


Wouter Heijke <wheijke@agency.com> wrote:
>Is it a bug or a feature?

A feature.

>
>Look at the piece of XSP below and notice the 'goodcustomid' static
>attribute and the 'badcustomid' dynamic added attribute to 'testxmltree'.
>When you run this XSP with cocoon (1.8.2) it shows something like this:
>
>goodcustomid = 'mystring'
>badcustomid = ' mystring '
>
>So the dynamically added attribute's value had whitespaced attatched to 
>it!!
>
>Am I doing something wrong here?

Yes, you have space around <xsp:expr>val</xsp:expr>.

>		<testxmltree goodcustomid="mystring">
>			<xsp:attribute name="badcustomid">
>  				<xsp:expr>val</xsp:expr>
>			</xsp:attribute>
>			<item id="foo">
>				<name>bar</name>
>			</item>
>		</testxmltree>
>	</page>
></xsp:page>
>
>
>and the stylesheet
>
>
><?xml version="1.0"?>
>
><xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>	<xsl:template match="page">
>	<xsl:processing-instruction
>name="cocoon-format">type="text/html"</xsl:processing-instruction>
>	<html>
>	<head>
>	</head>
>		<body>
>			<xsl:apply-templates/>
>		</body>
>	</html>
>	</xsl:template>
>
>	<xsl:template match="testxmltree">
>		<h1>goodcustomid = '<xsl:value-of
>select="@goodcustomid"/>'</h1>
>		<h1>badcustomid = '<xsl:value-of
>select="@badcustomid"/>'</h1>
>	</xsl:template>
></xsl:stylesheet>
>
>
>---------------------------------------------------------------------
>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>
>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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