You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Arnold, Curt" <Cu...@hyprotech.com> on 2000/02/17 17:23:52 UTC

RE: HTML (not XHTML) in a XSLT file and HTML within an XML docume nt

What you are running into is that you cannot have literal result elements in your XSLT file that are not well-formed XML.  If you want to build HTML that is not well formed XML, then you will have to
use the <xsl:element> and similar constructs.

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Erik Dasque <ed...@silverstream.com>.
right my fault. I thiugh you were talking about using another processor than
this one.

Ed.
----- Original Message -----
From: "Pierpaolo Fumagalli" <pi...@apache.org>
To: <xa...@xml.apache.org>
Sent: Friday, February 25, 2000 2:07 AM
Subject: Re: HTML (not XHTML) in a XSLT file and HTML within an XML document


> Naaah.... What're you talking about???? Simply remove that static field
> and change your code in this way:
>
>  XSLTInputSource xmlSource = new XSLTInputSource(document);
>  XSLTInputSource xslStylesheet = new XSLTInputSource(XSL_URL);
>
>  XSLTResultTarget xmlOutput = new XSLTResultTarget(outputstream);
>  XSLTProcessor processor = new XSLTEngineImpl(
>                      new org.apache.xalan.xpath.xdom.XercesLiaison());
>  processor.process(xmlSource, xslStylesheet, xmlOutput);
>
> Erik Dasque wrote:
> >
> > But I don't believe I can use the other one since I build my XML
document
> > in-memory and not by parsing it. Right ?
> --
> --------------------------------------------------------------------
> -          P              I              E              R          -
> stable structure erected over water to allow the docking of seacraft
> <ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
> --------------------------------------------------------------------
> - ApacheCON Y2K: Come to the official Apache developers conference -
> -------------------- <http://www.apachecon.com> --------------------


Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Pierpaolo Fumagalli wrote:
> 
> Naaah.... What're you talking about????

I just have realized how rude I was, sorry... There should have been a
bunch of smileys instead of the question marks :) :) :) :) 

	Pier


-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Naaah.... What're you talking about???? Simply remove that static field
and change your code in this way:

 XSLTInputSource xmlSource = new XSLTInputSource(document);
 XSLTInputSource xslStylesheet = new XSLTInputSource(XSL_URL);

 XSLTResultTarget xmlOutput = new XSLTResultTarget(outputstream);
 XSLTProcessor processor = new XSLTEngineImpl(
                     new org.apache.xalan.xpath.xdom.XercesLiaison());
 processor.process(xmlSource, xslStylesheet, xmlOutput);

Erik Dasque wrote:
> 
> But I don't believe I can use the other one since I build my XML document
> in-memory and not by parsing it. Right ?
-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Erik Dasque <ed...@silverstream.com>.
But I don't believe I can use the other one since I build my XML document
in-memory and not by parsing it. Right ?

Ed.
----- Original Message -----
From: "Pierpaolo Fumagalli" <pi...@apache.org>
To: <xa...@xml.apache.org>
Sent: Thursday, February 24, 2000 7:08 PM
Subject: Re: HTML (not XHTML) in a XSLT file and HTML within an XML document


> Erik Dasque wrote:
> >
> > remember I am using :
> >
> > static org.apache.xalan.xslt.XSLTProcessor processor = new
> > org.apache.xalan.xslt.XSLTEngineImpl(new
> > org.apache.xalan.xpath.xdom.XercesLiaison());
>
> You shouldn't use the static processor... XSLTProcessor is, AFAIK, not
> Thread safe (only the stylesheet should be)
>
> Pier
>
> --
> --------------------------------------------------------------------
> -          P              I              E              R          -
> stable structure erected over water to allow the docking of seacraft
> <ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
> --------------------------------------------------------------------
> - ApacheCON Y2K: Come to the official Apache developers conference -
> -------------------- <http://www.apachecon.com> --------------------


Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Erik Dasque wrote:
> 
> remember I am using :
> 
> static org.apache.xalan.xslt.XSLTProcessor processor = new
> org.apache.xalan.xslt.XSLTEngineImpl(new
> org.apache.xalan.xpath.xdom.XercesLiaison());

You shouldn't use the static processor... XSLTProcessor is, AFAIK, not
Thread safe (only the stylesheet should be)

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Erik Dasque <ed...@silverstream.com>.
remember I am using :

static org.apache.xalan.xslt.XSLTProcessor processor = new
org.apache.xalan.xslt.XSLTEngineImpl(new
org.apache.xalan.xpath.xdom.XercesLiaison());

as the XLST processor if that matters.

Ed.

----- Original Message -----
From: "Pierpaolo Fumagalli" <pi...@apache.org>
To: <xa...@xml.apache.org>
Sent: Thursday, February 24, 2000 6:32 PM
Subject: Re: HTML (not XHTML) in a XSLT file and HTML within an XML document


> Pierpaolo Fumagalli wrote:
> >
> > So, it's not coming up with all the &lt; and &gt; things... Ok.
> > So, I believe it's not a XALAN problem (wich works so far for me), but
> > of the serializer you're using... What do you use to serialize XML to a
> > stream????
>
> I believe we found what it was... This code:
>
>  XSLTInputSource xmlSource = new XSLTInputSource(document);
>  XSLTInputSource xslStylesheet = new XSLTInputSource(XSL_URL);
>
>  XSLTResultTarget xmlOutput = new XSLTResultTarget(outputstream);
>  processor.process(xmlSource, xslStylesheet, xmlOutput);
>
> is failing...
> It seems that the XSLTResultTarget, when receiving text (not an
> element), it doesn't convert <, > and & characters before sending them
> out to the outputstream... Is it in XALAN or in the XERCES serializers
> package?
>
> Pier
>
> --
> --------------------------------------------------------------------
> -          P              I              E              R          -
> stable structure erected over water to allow the docking of seacraft
> <ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
> --------------------------------------------------------------------
> - ApacheCON Y2K: Come to the official Apache developers conference -
> -------------------- <http://www.apachecon.com> --------------------


Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Pierpaolo Fumagalli wrote:
> 
> So, it's not coming up with all the &lt; and &gt; things... Ok.
> So, I believe it's not a XALAN problem (wich works so far for me), but
> of the serializer you're using... What do you use to serialize XML to a
> stream????

I believe we found what it was... This code:

 XSLTInputSource xmlSource = new XSLTInputSource(document);
 XSLTInputSource xslStylesheet = new XSLTInputSource(XSL_URL);

 XSLTResultTarget xmlOutput = new XSLTResultTarget(outputstream);
 processor.process(xmlSource, xslStylesheet, xmlOutput);

is failing...
It seems that the XSLTResultTarget, when receiving text (not an
element), it doesn't convert <, > and & characters before sending them
out to the outputstream... Is it in XALAN or in the XERCES serializers
package?

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Erik Dasque wrote:
> 
> like so (XHTML code)
> 
> When dealing with remote objects, such as Enterprise JavaBeans (EJB), some
> of the biggest performance problems can be traced to network traffic. A
> method call that has to be marshaled over a socket connection is going to be
> much slower than a method call issued in local memory. The following piece
> of client code, which assumes that &lt;code&gt;bean&lt;/code&gt; is a handle
> to an EJB, makes &lt;em&gt;six&lt;/em&gt; remote calls (remember, red here
> stands for client code):

So, it's not coming up with all the &lt; and &gt; things... Ok.
So, I believe it's not a XALAN problem (wich works so far for me), but
of the serializer you're using... What do you use to serialize XML to a
stream????

	Pier
-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Erik Dasque <ed...@silverstream.com>.
like so (XHTML code)

When dealing with remote objects, such as Enterprise JavaBeans (EJB), some
of the biggest performance problems can be traced to network traffic. A
method call that has to be marshaled over a socket connection is going to be
much slower than a method call issued in local memory. The following piece
of client code, which assumes that &lt;code&gt;bean&lt;/code&gt; is a handle
to an EJB, makes &lt;em&gt;six&lt;/em&gt; remote calls (remember, red here
stands for client code):

Which comes up like this in the browser:

When dealing with remote objects, such as Enterprise JavaBeans (EJB), some
of the
                            biggest performance problems can be traced to
network traffic. A method call that has to
                            be marshaled over a socket connection is going
to be much slower than a method call
                            issued in local memory. The following piece of
client code, which assumes that
                            <code>bean</code> is a handle to an EJB, makes
<em>six</em> remote calls
                            (remember, red here stands for client code):

Ed.
----- Original Message -----
From: "Pierpaolo Fumagalli" <pi...@apache.org>
To: <xa...@xml.apache.org>
Sent: Thursday, February 24, 2000 5:24 PM
Subject: Re: HTML (not XHTML) in a XSLT file and HTML within an XML document


> Erik Dasque wrote:
> >
> > This is my XML document :
> >
> > As you can see it contains CDATAs. The XSL process still escapes it
though.
>
> What does "escapes" means? How does your output look like???
> --
> --------------------------------------------------------------------
> -          P              I              E              R          -
> stable structure erected over water to allow the docking of seacraft
> <ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
> --------------------------------------------------------------------
> - ApacheCON Y2K: Come to the official Apache developers conference -
> -------------------- <http://www.apachecon.com> --------------------


Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Erik Dasque wrote:
> 
> This is my XML document :
> 
> As you can see it contains CDATAs. The XSL process still escapes it though.

What does "escapes" means? How does your output look like???
-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Erik Dasque wrote:
> 
> This is my XML document :
> 
> As you can see it contains CDATAs. The XSL process still escapes it though.

What does "escapes" means? How does your output look like???
-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Erik Dasque <ed...@silverstream.com>.
This is my XML document :

<?xml version="1.0" standalone="yes"?>
<DOCUMENT DOC_ID="3" DateCreated="02/08/2000 00:00"
    MimeType="text/plain" Version="1">
    <Author AUTHOR_ID="1">
        <FirstName>John</FirstName>
        <LastName>Archer</LastName>
        <EMail>jarcher@silverstream.com</EMail>
        <Title>Technical Marketing Manager</Title>
    </Author>
    <BODY><![CDATA[When dealing with remote objects, such as Enterprise
JavaBeans (EJB), some of the biggest performance problems can be traced to
network traffic. A method call that has to be marshaled over a socket
connection is going to be much slower than a method call issued in local
memory. The following piece of client code, which assumes that
<code>bean</code> is a handle to an EJB, makes <em>six</em> remote calls
(remember, red here stands for client code):]]></BODY>
    <TITLE>This is the title of the test doc</TITLE>
</DOCUMENT>

As you can see it contains CDATAs. The XSL process still escapes it though.

Ed.



----- Original Message -----
From: "Pierpaolo Fumagalli" <pi...@apache.org>
To: <xa...@xml.apache.org>
Sent: Thursday, February 24, 2000 2:34 PM
Subject: Re: HTML (not XHTML) in a XSLT file and HTML within an XML document


> Erik Dasque wrote:
> >
> > Also, how can you have an element text node to be non parsed HTML (which
> > would cause the XML document to be non valid) ?
> >
> > Something like
> > <DOCUMENT>
> > <HTML_BODY> [*---<HTML>....</HTML> ---*]
> > </HTML_BODY>
> > </DOCUMENT>
>
> Have you tried <![CDATA[ .... ]]>????
>
> Pier
>
> --
> --------------------------------------------------------------------
> -          P              I              E              R          -
> stable structure erected over water to allow the docking of seacraft
> <ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
> --------------------------------------------------------------------
> - ApacheCON Y2K: Come to the official Apache developers conference -
> -------------------- <http://www.apachecon.com> --------------------


Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Erik Dasque wrote:
> 
> Also, how can you have an element text node to be non parsed HTML (which
> would cause the XML document to be non valid) ?
> 
> Something like
> <DOCUMENT>
> <HTML_BODY> [*---<HTML>....</HTML> ---*]
> </HTML_BODY>
> </DOCUMENT>

Have you tried <![CDATA[ .... ]]>????

	Pier

--
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: HTML (not XHTML) in a XSLT file and HTML within an XML document

Posted by Erik Dasque <ed...@silverstream.com>.
Can someone elaborate on this question :

Also, how can you have an element text node to be non parsed HTML (which
would cause the XML document to be non valid) ?

Something like
<DOCUMENT>
<HTML_BODY> [*---<HTML>....</HTML> ---*]
</HTML_BODY>
</DOCUMENT>

where the HTMLBODY being included as is (not espaced with &lt;) by XALAN



----- Original Message -----
From: "Arnold, Curt" <Cu...@hyprotech.com>
To: <xa...@xml.apache.org>
Sent: Thursday, February 17, 2000 11:23 AM
Subject: RE: HTML (not XHTML) in a XSLT file and HTML within an XML document


> What you are running into is that you cannot have literal result elements
in your XSLT file that are not well-formed XML.  If you want to build HTML
that is not well formed XML, then you will have to
> use the <xsl:element> and similar constructs.