You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stephanie Zohner <st...@gmx.at> on 2003/10/30 14:30:35 UTC

Removing whitespace in XSP generated XML

Hi,

According to the messages in the Mail Archive my problem is well known, but
I could not find an proper solution in it. So maybe this time ?!

I have unwanted whitespace in XSP generated attributes:

For example:

XSP-Code like this:

<user>
      <xsp:attribute name="email">
                <xsp:expr>request.getParameterValues("users")[i]</xsp:expr>
      </xsp:attribute>
</user>

Result into:

<user email="&#10;                            users@apache.cocoon.org&#10;  
                     "/>


The offered solutions are:
Strip the whitespace out of the XSP-page manuelly, so it won't appear in the
output. 
I edit my XML Files with XML Spy, so this solution in not good. It
obliterates the XSP file.

Another offered solution is the xslt-function normalize-space.
This however, did not work as expected so far. I assume this is because,
normalize-space removes no
"&#10;", which is the first character in my atibute values.

Is there a way to prevent unwanted whitespace in the XSP, and if not how can
XSLT help in my case (&#10;)

I would be very glad, if anybody can help me with this.

Thanks,

Stephanie

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++


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


Re: Removing whitespace in XSP generated XML

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Stephanie Zohner wrote:
> Another offered solution is the xslt-function normalize-space.
> This however, did not work as expected so far. I assume this is because,
> normalize-space removes no
> "&#10;", which is the first character in my atibute values.
That's a bit odd because a LF is supposed to be  whitespace too.
But you can try translate(.,'&#10; ','')

J.Pietschmann


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


Re: Removing whitespace in XSP generated XML

Posted by Joerg Heinicke <jh...@virbus.de>.
We could easily add

<xsl:strip-space elements="xsp:attribute"/>

to the xsp.xsl for avoiding the need to write

<xsp:attribute 
name="email"><xsp:expr>request.getParameterValues("users")[i]</xsp:expr></xsp:attribute>

(i.e. without any linebreak). The problem is, that we can break other 
user's code, when they rely on the whitespace handling as it is. But 
it's true, many people have problems with the whitespace handling for 
attributes and do it the way above. Furthermore we have

<xsp:text> </xsp:text>

for adding single spaces (or as much as they want).

Question to the developers: Can we change the whitespace handling for 
<xsp:attribute/>?

Joerg


On 30.10.2003 14:30, Stephanie Zohner wrote:

> Hi,
> 
> According to the messages in the Mail Archive my problem is well known, but
> I could not find an proper solution in it. So maybe this time ?!
> 
> I have unwanted whitespace in XSP generated attributes:
> 
> For example:
> 
> XSP-Code like this:
> 
> <user>
>       <xsp:attribute name="email">
>                 <xsp:expr>request.getParameterValues("users")[i]</xsp:expr>
>       </xsp:attribute>
> </user>
> 
> Result into:
> 
> <user email="&#10;                            users@apache.cocoon.org&#10;  
>                      "/>
> 
> 
> The offered solutions are:
> Strip the whitespace out of the XSP-page manuelly, so it won't appear in the
> output. 
> I edit my XML Files with XML Spy, so this solution in not good. It
> obliterates the XSP file.
> 
> Another offered solution is the xslt-function normalize-space.
> This however, did not work as expected so far. I assume this is because,
> normalize-space removes no
> "&#10;", which is the first character in my atibute values.
> 
> Is there a way to prevent unwanted whitespace in the XSP, and if not how can
> XSLT help in my case (&#10;)
> 
> I would be very glad, if anybody can help me with this.
> 
> Thanks,
> 
> Stephanie


Re: Removing whitespace in XSP generated XML

Posted by Joerg Heinicke <jh...@virbus.de>.
We could easily add

<xsl:strip-space elements="xsp:attribute"/>

to the xsp.xsl for avoiding the need to write

<xsp:attribute 
name="email"><xsp:expr>request.getParameterValues("users")[i]</xsp:expr></xsp:attribute>

(i.e. without any linebreak). The problem is, that we can break other 
user's code, when they rely on the whitespace handling as it is. But 
it's true, many people have problems with the whitespace handling for 
attributes and do it the way above. Furthermore we have

<xsp:text> </xsp:text>

for adding single spaces (or as much as they want).

Question to the developers: Can we change the whitespace handling for 
<xsp:attribute/>?

Joerg


On 30.10.2003 14:30, Stephanie Zohner wrote:

> Hi,
> 
> According to the messages in the Mail Archive my problem is well known, but
> I could not find an proper solution in it. So maybe this time ?!
> 
> I have unwanted whitespace in XSP generated attributes:
> 
> For example:
> 
> XSP-Code like this:
> 
> <user>
>       <xsp:attribute name="email">
>                 <xsp:expr>request.getParameterValues("users")[i]</xsp:expr>
>       </xsp:attribute>
> </user>
> 
> Result into:
> 
> <user email="&#10;                            users@apache.cocoon.org&#10;  
>                      "/>
> 
> 
> The offered solutions are:
> Strip the whitespace out of the XSP-page manuelly, so it won't appear in the
> output. 
> I edit my XML Files with XML Spy, so this solution in not good. It
> obliterates the XSP file.
> 
> Another offered solution is the xslt-function normalize-space.
> This however, did not work as expected so far. I assume this is because,
> normalize-space removes no
> "&#10;", which is the first character in my atibute values.
> 
> Is there a way to prevent unwanted whitespace in the XSP, and if not how can
> XSLT help in my case (&#10;)
> 
> I would be very glad, if anybody can help me with this.
> 
> Thanks,
> 
> Stephanie


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