You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by beyaNet Consultancy <be...@ntlworld.com> on 2004/03/26 18:07:34 UTC
Character encoding...
Hi,
I am trying to obtain the encoding type as specified in at the top of
my site page when you view source the page. At the moment the encoding
type is specified as:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
<html>
I was under the impression that if i used
<xsp-request:get-character-encoding> that it would return UTF-8, in
this instance. At the moment it is returning ISO-8859-1 which is the
encoding type of the server. How do I get the encoding type as
specified within my page?
many thanks in advance
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Transformer lost the structure of input stream???
Posted by Lionel Crine <cr...@4dconcept.fr>.
This is an xslt question.
You should send a message to : xsl-list@lists.mulberrytech.com
But here is an hint.
The xslt transformer is not implicated in that case.
Your match overall is incomplete if you want to copy all the nodes.
try that :
<xsl:template match="overall">
<FirstStream>
<xsl:copy>
<xsl:apply-templates select="stream1"/>
</xsl:copy>
</FirstStream>
<SecondStream>
<xsl:copy>
<xsl:apply-templates select="stream2|stream3"/>
</xsl:copy>
</SecondStream>
Lionel
At 02:11 27/03/2004 -0800, you wrote:
>I tried to aggregate several xml streams and transform the aggregated
>stream by a xsl transformer. all goes well except that the markup, for example
>I want the output to be
><FirstStream><name> TheFirstName </name> <data> TheFirstData
></data> /FirstStream>....
>
>But the output I got
>is: <FirstStream> TheFirstName TheFirstData </FirstStream>....
>
>the" <name>" and "<data>"is lost, does anybody have some idea why?
>here is my input streams, pipeline and transformer, thanks for your time
>and help ve~~~~~~~~ry much indeed
>
>//lechael
>
>
><xsl:template match="overall">
><FirstStream><xsl:apply-templates select="stream1"/>
></FirstStream>
><SecondStream>
> <xsl:apply-templates select="stream2|stream3"/>
> <SecondStream></xsl:template>
>
>Stream1.xml:
><stream1>
> <name>
> TheFirstName
> </name>
>
> <data>
> TheFirstData
> </data>
></stream1>
>
>Stream2.xml:
><stream2>
> <despt>
> here is the descript
> </despt>
> <remark>
> Here is the remark
> </remark>
></stream2>
>
>and here is my pipeline:
> <map:match pattern="aggregated">
> <map:aggregate element="overall">
> <map:part src="stream1.xml"/>
> <map:part src="stream2.xml"/>
><map:part src="stream3.xml"/>
></map:aggregate>
><map:transform src="stylesheet.xsl">
><map:serialize type="html" />
></map:match>
Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.58.70.70
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Transformer lost the structure of input stream???
Posted by lech <le...@hotmail.com>.
I tried to aggregate several xml streams and transform the aggregated stream by a xsl transformer. all goes well except that the markup, for example
I want the output to be
<FirstStream><name> TheFirstName </name> <data> TheFirstData </data> /FirstStream>....
But the output I got is: <FirstStream> TheFirstName TheFirstData </FirstStream>....
the" <name>" and "<data>"is lost, does anybody have some idea why?
here is my input streams, pipeline and transformer, thanks for your time and help ve~~~~~~~~ry much indeed
//lechael
<xsl:template match="overall">
<FirstStream><xsl:apply-templates select="stream1"/>
</FirstStream>
<SecondStream>
<xsl:apply-templates select="stream2|stream3"/>
<SecondStream></xsl:template>
Stream1.xml:
<stream1>
<name>
TheFirstName
</name>
<data>
TheFirstData
</data>
</stream1>
Stream2.xml:
<stream2>
<despt>
here is the descript
</despt>
<remark>
Here is the remark
</remark>
</stream2>
and here is my pipeline:
<map:match pattern="aggregated">
<map:aggregate element="overall">
<map:part src="stream1.xml"/>
<map:part src="stream2.xml"/>
<map:part src="stream3.xml"/>
</map:aggregate>
<map:transform src="stylesheet.xsl">
<map:serialize type="html" />
</map:match>
Re: Character encoding...
Posted by Joerg Heinicke <jo...@gmx.de>.
On 27.03.2004 11:26, beyaNet Consultancy wrote:
> Hi Marc,
> I am trying to achieve the following:
>
> 1. Determine, in my sitemap, whether a browser is XHTML 1.1 compatible.
> If it is, the XHTML 1.1 serializer is used, which when view sourced in
> the browser you see:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
>
> Now, as part of the XHTML 1.1 specification you also need to say the
> following in the <html> tag:
>
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> I have not found a way in the serialization process of writing the
> xmlns line into the <html> tag if the browser viewing the site is XHTML
> 1.1 compatible, so I thought maybe if I specify UTF-8 as the encoding
> type for XHTML 1.1 browsers and a different encoding type for non 1.1
> browsers, I could then dynamically write the xmlns line into the tag if
> the browser was XHTML 1.1 compatible.
>
> Do you know of a more efficient way I could probably do this?
>
> Peter
This is only possible by operating on the XML stream, for example using
an additional stylesheet that puts all your HTML elements into XHTML
namespace. But wouldn't it be possible to put them always in that
namespace, i.e. does not the HTMLSerializer remove this namespace?
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Character encoding...
Posted by beyaNet Consultancy <be...@ntlworld.com>.
Hi Marc,
I am trying to achieve the following:
1. Determine, in my sitemap, whether a browser is XHTML 1.1 compatible.
If it is, the XHTML 1.1 serializer is used, which when view sourced in
the browser you see:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
Now, as part of the XHTML 1.1 specification you also need to say the
following in the <html> tag:
<html xmlns="http://www.w3.org/1999/xhtml">
I have not found a way in the serialization process of writing the
xmlns line into the <html> tag if the browser viewing the site is XHTML
1.1 compatible, so I thought maybe if I specify UTF-8 as the encoding
type for XHTML 1.1 browsers and a different encoding type for non 1.1
browsers, I could then dynamically write the xmlns line into the tag if
the browser was XHTML 1.1 compatible.
Do you know of a more efficient way I could probably do this?
Peter
p.s.
sitemap snippet:
<map:serializer name="xhtml"
src="org.apache.cocoon.serialization.XMLSerializer"
mime-type="text/html" logger="sitemap.serializer.xhtml" pool-grow="2"
pool-max="64" pool-min="2">
<doctype-public>-//W3C//DTD XHTML 1.1 //EN</doctype-public>
<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd</doctype-
system>
<encoding>UTF-8</encoding>
<indent>yes</indent>
</map:serializer>
<map:serializer name="html" mime-type="text/html"
src="org.apache.cocoon.serialization.HTMLSerializer">
<indent>yes</indent>
<encoding>ISO-8859-1</encoding>
<omit-xml-declaration>no</omit-xml-declaration>
<doctype-public>-//W3C//DTD XHTML 1.0
Transitional//EN</doctype-public>
<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd</
doctype-system>
</map:serializer>
........
<map:resource name="serialize">
<map:select type="browser">
<map:when test="safari">
<map:serialize type="html"/>
</map:when>
<map:otherwise>
<map:serialize type="xhtml"/>
</map:otherwise>
</map:select>
</map:resource>
.......
<map:match pattern="unsupport/menu">
<map:generate type="serverpages" src="xsp/menu2.xsp"/>
<map:call resource="serialize"/>
</map:match>
On 27 Mar 2004, at 07:30, Marc Portier wrote:
> Peter,
>
> sorry for the bad advice then, but you lost me,
> pls elaborate on where you see what and how your setup is looking
> and what you try to achieve
>
> regards,
> -marc=
>
> beyaNet Consultancy wrote:
>
>> Marc,
>> I am using Cocoon version 2.1.4. I have made the changes you
>> mentioned, but nothing has really changed. If I now
>> <xsp-request:get-character-encoding> and change the encoding in the
>> page so that it now reads <?xml version="1.0" encoding="ISO-8859-1"?>
>> i still only get what is specified in the web.xml document and not in
>> the web-page. Any ideas?
>> Peter
>> On 26 Mar 2004, at 23:08, Marc Portier wrote:
>> beyaNet Consultancy wrote:
>> Hi,
>> I am trying to obtain the encoding type as specified in at the
>> top of my site page when you view source the page. At the
>> moment
>> the encoding type is specified as:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
>> <html>
>> I was under the impression that if i used
>> <xsp-request:get-character-encoding> that it would return
>> UTF-8,
>> in this instance. At the moment it is returning ISO-8859-1
>> which
>> is the encoding type of the server. How do I get the encoding
>> type as specified within my page?
>> which version of cocoon are you using?
>> pre 2.1.3 there was a possible mismatch between the encoding used
>> in
>> the html-generation (encoding) and the one used in the
>> request-parameter-processing (decoding)
>> this should be fixed per
>>
>> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/
>> cocoon/serialization/AbstractTextSerializer.java?rev=1.6&view=markup
>>
>> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/
>> cocoon/servlet/CocoonServlet.java?rev=1.20&view=markup
>> prior to this you can manually assure that both sides are in sync:
>> just make sure the encoding set-up in your <serializer> (see it's
>> config in sitemap.xmap) is matching the setting in the web.xml
>> (see
>> init-param 'form-encoding' to the cocoon servlet)
>> HTH,
>> -marc=
>> many thanks in advance
>> Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>> -- Marc Portier http://outerthought.org/
>> Outerthought - Open Source, Java & XML Competence Support Center
>> Read my weblog at http://blogs.cocoondev.org/mpo/
>> mpo@outerthought.org mpo@apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>
> --
> Marc Portier http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> Read my weblog at http://blogs.cocoondev.org/mpo/
> mpo@outerthought.org mpo@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
Re: Character encoding...
Posted by Marc Portier <mp...@outerthought.org>.
Peter,
sorry for the bad advice then, but you lost me,
pls elaborate on where you see what and how your setup is looking
and what you try to achieve
regards,
-marc=
beyaNet Consultancy wrote:
> Marc,
> I am using Cocoon version 2.1.4. I have made the changes you mentioned,
> but nothing has really changed. If I now
> <xsp-request:get-character-encoding> and change the encoding in the page
> so that it now reads <?xml version="1.0" encoding="ISO-8859-1"?> i still
> only get what is specified in the web.xml document and not in the
> web-page. Any ideas?
>
> Peter
> On 26 Mar 2004, at 23:08, Marc Portier wrote:
>
>
>
> beyaNet Consultancy wrote:
>
> Hi,
> I am trying to obtain the encoding type as specified in at the
> top of my site page when you view source the page. At the moment
> the encoding type is specified as:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
> <html>
> I was under the impression that if i used
> <xsp-request:get-character-encoding> that it would return UTF-8,
> in this instance. At the moment it is returning ISO-8859-1 which
> is the encoding type of the server. How do I get the encoding
> type as specified within my page?
>
>
> which version of cocoon are you using?
>
> pre 2.1.3 there was a possible mismatch between the encoding used in
> the html-generation (encoding) and the one used in the
> request-parameter-processing (decoding)
>
> this should be fixed per
> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java?rev=1.6&view=markup
>
> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=1.20&view=markup
>
>
> prior to this you can manually assure that both sides are in sync:
> just make sure the encoding set-up in your <serializer> (see it's
> config in sitemap.xmap) is matching the setting in the web.xml (see
> init-param 'form-encoding' to the cocoon servlet)
>
> HTH,
> -marc=
>
> many thanks in advance
> Peter
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> --
> Marc Portier http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> Read my weblog at http://blogs.cocoondev.org/mpo/
> mpo@outerthought.org mpo@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
--
Marc Portier http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at http://blogs.cocoondev.org/mpo/
mpo@outerthought.org mpo@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Character encoding...
Posted by beyaNet Consultancy <be...@ntlworld.com>.
Marc,
I am using Cocoon version 2.1.4. I have made the changes you mentioned,
but nothing has really changed. If I now
<xsp-request:get-character-encoding> and change the encoding in the
page so that it now reads <?xml version="1.0" encoding="ISO-8859-1"?> i
still only get what is specified in the web.xml document and not in the
web-page. Any ideas?
Peter
On 26 Mar 2004, at 23:08, Marc Portier wrote:
>
>
> beyaNet Consultancy wrote:
>
>> Hi,
>> I am trying to obtain the encoding type as specified in at the top of
>> my site page when you view source the page. At the moment the
>> encoding type is specified as:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
>> <html>
>> I was under the impression that if i used
>> <xsp-request:get-character-encoding> that it would return UTF-8, in
>> this instance. At the moment it is returning ISO-8859-1 which is the
>> encoding type of the server. How do I get the encoding type as
>> specified within my page?
>
> which version of cocoon are you using?
>
> pre 2.1.3 there was a possible mismatch between the encoding used in
> the html-generation (encoding) and the one used in the
> request-parameter-processing (decoding)
>
> this should be fixed per
> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/
> cocoon/serialization/AbstractTextSerializer.java?rev=1.6&view=markup
> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/
> cocoon/servlet/CocoonServlet.java?rev=1.20&view=markup
>
> prior to this you can manually assure that both sides are in sync:
> just make sure the encoding set-up in your <serializer> (see it's
> config in sitemap.xmap) is matching the setting in the web.xml (see
> init-param 'form-encoding' to the cocoon servlet)
>
> HTH,
> -marc=
>
>> many thanks in advance
>> Peter
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>
> --
> Marc Portier http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> Read my weblog at http://blogs.cocoondev.org/mpo/
> mpo@outerthought.org mpo@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
Re: Character encoding...
Posted by Marc Portier <mp...@outerthought.org>.
beyaNet Consultancy wrote:
> Hi,
> I am trying to obtain the encoding type as specified in at the top of my
> site page when you view source the page. At the moment the encoding type
> is specified as:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
> <html>
>
> I was under the impression that if i used
> <xsp-request:get-character-encoding> that it would return UTF-8, in this
> instance. At the moment it is returning ISO-8859-1 which is the
> encoding type of the server. How do I get the encoding type as specified
> within my page?
>
which version of cocoon are you using?
pre 2.1.3 there was a possible mismatch between the encoding used in the
html-generation (encoding) and the one used in the
request-parameter-processing (decoding)
this should be fixed per
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java?rev=1.6&view=markup
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=1.20&view=markup
prior to this you can manually assure that both sides are in sync:
just make sure the encoding set-up in your <serializer> (see it's config
in sitemap.xmap) is matching the setting in the web.xml (see init-param
'form-encoding' to the cocoon servlet)
HTH,
-marc=
> many thanks in advance
>
>
> Peter
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
--
Marc Portier http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at http://blogs.cocoondev.org/mpo/
mpo@outerthought.org mpo@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org