You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "pmirco@inwind.it" <pm...@inwind.it> on 2002/12/03 14:45:51 UTC
escaping special characthers: xsp or xslt problem?
I'm reading some data from a database (mysql) using an xsp page.
My xsp is very simple, something like:
<esql:results>
<news>
<esql:row-results>
<title><esql:get-string column="title"/></title>
</esql:row-results>
</news>
</esql:results>
Then I fill a text field using this data:
<input type="text" name="title" size="50" maxlength="100">
<xsl:attribute name="value"><xsl:value-of select="normalize-space
(news/title)" disable-output-escaping="yes"/></xsl:attribute>
</input>
When I wrote my data into the database, I converted special characters
like "à" to "à" (I think this is a good practice, but correct me
if I'm wrong!).
My problem is that the result after XSLT processing is:
<input maxlength="100" size="50" name="titolo" type="text"
value="&#224;">
and this is not what I really want, 'cause the user don't see the
character "à" but the string "à".
As you can see, I've used the attribute "disable-output-escaping", but
the output IS escaped.
If I try to output the content of (news/title) with a simple <xsl:value-
of select> (not wrapped by xsl:attribute), the characther is displayed
as I expect.
any suggestion?
---------------------------------------------------------------------
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: escaping special characthers: xsp or xslt problem?
Posted by Joerg Heinicke <jo...@gmx.de>.
Hello,
there shell be no difference between <xsl:value-of/> with
<xsl:attribute/> or without it. What I can definitively say, is, that
you don't need disable-output-escaping in general. Is there any
difference between with or without it? d-o-e shell only be used, if you
need < (less than) in a non XML conformant way like PHP (<? ... ?>) or
JSP (<%). But you use Cocoon, so there shell be no need in (again)
general. Can you look at the result of the XSP without transforming it?
The problem in your case seems to be the <esql:get-string/>. The data
will be escaped then. Doesn't there exist a <esql:get-xml/>?
Regards,
Joerg
pmirco@inwind.it wrote:
> I'm reading some data from a database (mysql) using an xsp page.
>
> My xsp is very simple, something like:
> <esql:results>
> <news>
> <esql:row-results>
> <title><esql:get-string column="title"/></title>
> </esql:row-results>
> </news>
> </esql:results>
>
> Then I fill a text field using this data:
>
> <input type="text" name="title" size="50" maxlength="100">
> <xsl:attribute name="value"><xsl:value-of select="normalize-space
> (news/title)" disable-output-escaping="yes"/></xsl:attribute>
> </input>
>
> When I wrote my data into the database, I converted special characters
> like "à" to "à" (I think this is a good practice, but correct me
> if I'm wrong!).
>
> My problem is that the result after XSLT processing is:
> <input maxlength="100" size="50" name="titolo" type="text"
> value="&#224;">
> and this is not what I really want, 'cause the user don't see the
> character "à" but the string "à".
>
> As you can see, I've used the attribute "disable-output-escaping", but
> the output IS escaped.
> If I try to output the content of (news/title) with a simple <xsl:value-
> of select> (not wrapped by xsl:attribute), the characther is displayed
> as I expect.
>
> any suggestion?
---------------------------------------------------------------------
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>