You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Diethelm Guallar, Gonzalo" <Go...@sonda.com> on 2000/06/10 01:04:02 UTC

XSP: used with XML or XSL (or both)?

[Hopefully, this is not annoyingly clueless...]

Where are you supposed to actually put your XSP code:
in the XML file, in the XSL template, in any of them?
The "Good Morning/Afternoon" example in
http://xml.apache.org/cocoon/xsp.html uses XSP in the
XML file, but there is also an example that starts
like this:

<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:example="http://www.plenix.com/DTD/XSP/Example"
>
 <xsl:template match="xsp:page">
  <xsp:page>
   <xsl:copy>
    <xsl:apply-templates select="@*"/>
   </xsl:copy>
   <xsp:structure>
    <xsp:include>java.util.Date</xsp:include>
    <xsp:include>java.text.SimpleDateFormat</xsp:include>
   </xsp:structure>
   ...

and this is clearly XSL code. Does this mean XSP can be
used in both? If so, what is the processing order for an
XSP page? I mean, is it something like:

1. Process XSP in the XML page, leave pure XML.
2. Process XSP in the XSL page, leave pure XSL.
3. Apply the XSL page to the XML page, leaving... whatever
   the output should be (say it is HTML).

Is this correct? Am I totally confused here? Is the
universe finite but without boundaries?

Thanks,


-- 
Gonzalo A. Diethelm
gonzalo.diethelm@sonda.com

Re: XSP: used with XML or XSL (or both)?

Posted by Uli Mayring <ul...@denic.de>.
On Fri, 9 Jun 2000, Diethelm Guallar, Gonzalo wrote:

> and this is clearly XSL code. Does this mean XSP can be
> used in both? If so, what is the processing order for an
> XSP page? I mean, is it something like:
> 
> 1. Process XSP in the XML page, leave pure XML.
> 2. Process XSP in the XSL page, leave pure XSL.
> 3. Apply the XSL page to the XML page, leaving... whatever
> �� the output should be (say it is HTML).

XSL is also XML, so from the point of view of the XSP processor it is the
same thing. The processing order depends on the order of the processing
instructions at the top of the files. So you can have many cases, for
example:

1. run XSP processor on XML file, resulting in new/changed XML
2. transform this XML with a XSLT stylesheet
3. send resulting HTML back to browser

or

1. run XSP processor on XML file, resulting in new/changed XML
2. send this XML to a XSLT stylesheet
3. In stylesheet add/change XML via XSP
4. send new/changed XML to another XSLT stylesheet
5. in this stylesheet transform XML to XSL:FO
6. send XSL:FO to fop, generating a PDF
7. send PDF back to browser

So, basically, you can do what you want :)

Ulrich

-- 
Ulrich Mayring
DENIC eG, Softwareentwicklung