You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robin Green <gr...@hotmail.com> on 2000/04/23 13:34:49 UTC

Re: One XML file -> multiple HTML

d96-mst-ingen-reklam@d.kth.se (Mikael Stĺldal) wrote:
>Is it possible to generate several HTML files from one single XML file
>using Cocoon?

Yes. This is what dynamic content means.

http://xml.apache.org/cocoon/dynamic.html

What precisely did you want to do?

--
Robin

270+ Open Source Java links! 
http://directory.mozilla.org/Computers/Programming/Languages/Java/Open_Source/

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Re: One XML file -> multiple HTML

Posted by Mikael St�ldal <d9...@d.kth.se>.
In article <20...@hotmail.com>,
"Robin Green" <gr...@hotmail.com> wrote:

>>Is it possible to generate several HTML files from one single XML file
>>using Cocoon?
>
>Yes. This is what dynamic content means.
>
>http://xml.apache.org/cocoon/dynamic.html
>
>What precisely did you want to do?

I have one XML document structured like this:

<entries>
<entry foo="abc" bar="123">
bla <b>bla</b> bla
</entry>
<entry foo="abc" bar="456">
hey <c>hey</c> hoo
</entry>
<entry foo="xyz" bar="123">
blahonga
</entry>
<!-- many more entries -->
</entries>

And I want each <entry> element end up in one HTML output (via an XSLT
stylesheet). Each <entry> has some parameters that taken togethet gives
you an unique id of that entry (can be used to generate output
filename/URL).

-- 
/****************************************************************\
* You have just read a message from Mikael Ståldal.              *
*                                                                *
* Remove "-ingen-reklam" from the address before mail replying.  *
\****************************************************************/

Re: One XML file -> multiple HTML

Posted by tom stuart <to...@obsess.com>.
On Mon, 24 Apr 2000, Elaine Brennan wrote:
> you can put calls to multiple stylesheets in the same XML file, using a 
> combination of the "title", "media", and "alternative" attributes to 
> describe which stylesheet to use in which instance:
> 
>            <?xml-stylesheet alternate="no" title="standard" 
> href="mystuff.css" type="text/css" ?>
>             <?xml-stylesheet alternate="yes" title="print pdf " 
> media="paper" href="pdf.css"  type="text/css"?>
>             <?xml-stylesheet alternate="yes" title="compact" media="web" 
> href="small-extras.css" type="text/css"?>

Alright... but how does that work? I feel like I'm being stupid, but how
does this tie into URL requests? All I want is to be able to provide:

	http://mysite/cv/cv-html.xml
	http://mysite/cv/cv-pdf.xml
	http://mysite/cv/cv-compact.xml

or even:

	http://mysite/cv/cv.xml?html
	http://mysite/cv/cv.xml?pdf
	http://mysite/cv/cv.xml?compact

or, or... *something*, so that with a web browser you can retrieve
different XSLT-generated presentations of a single XML file. What does
that title="" attribute do, and under what circumstances will Cocoon
select, say, the "print pdf" alternative over the "standard" one?

I've looked at the xml-stylesheet recommendation, and the <LINK> section
in the HTML4 standard, but I can't find anything to suggest what possible
application the title attribute has in this context.

Any clues?

Thanks,
-Tom


Re: One XML file -> multiple HTML

Posted by Elaine Brennan <el...@worldnet.att.net>.
At 03:56 PM 4/24/00 (+0100), Tom wrote:

>On Sun, 23 Apr 2000, Robin Green wrote:
> > d96-mst-ingen-reklam@d.kth.se (Mikael Ståldal) wrote:
> > >Is it possible to generate several HTML files from one single XML file
> > >using Cocoon?
> >
> > Yes. This is what dynamic content means.
> > What precisely did you want to do?
>
>Well, I'm not sure what Mikael wanted to do, but to follow on with what
>might be an illustrative example:
>
>I've got my CV (resume) on my web site, and constantly updating the plain
>text, HTML and PDF versions of it is an ongoing nightmare. So, I want to
>redo the whole thing in XML/XSL. It would be nice to present a web
>interface for generating HTML, plain formatted text, PDF, raw source XML
>(you never know) and, say, some alternative HTML documents too (a summary
>version, or one with a different layout) from the same source XML content,
>just by requesting different URLs.
>
>...
>Can you do this, without resorting to writing Java (and XSP if possible)?
>All of the complicated functionality is present (XML -[XSL]-> result XML
>-[formatter]-> HTML/PDF) but to make several copies of the XML file just
>for the purpose of putting different <?xml-stylesheet?> tags in each one
>seems to defy the whole point of separating the content.
>
>What's the (official) solution?

you can put calls to multiple stylesheets in the same XML file, using a 
combination of the "title", "media", and "alternative" attributes to 
describe which stylesheet to use in which instance:

           <?xml-stylesheet alternate="no" title="standard" 
href="mystuff.css" type="text/css" ?>
            <?xml-stylesheet alternate="yes" title="print pdf " 
media="paper" href="pdf.css"  type="text/css"?>
            <?xml-stylesheet alternate="yes" title="compact" media="web" 
href="small-extras.css" type="text/css"?>

--ELaine

Re: One XML file -> multiple HTML

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 24 Apr 2000, tom stuart wrote:

> I've got my CV (resume) on my web site, and constantly updating the plain
> text, HTML and PDF versions of it is an ongoing nightmare. So, I want to
> redo the whole thing in XML/XSL. It would be nice to present a web
> interface for generating HTML, plain formatted text, PDF, raw source XML
> (you never know) and, say, some alternative HTML documents too (a summary
> version, or one with a different layout) from the same source XML content,
> just by requesting different URLs.
> 
> Or maybe you have a manual contained within one large XML file, and would
> like to generate one HTML page with just a generated contents list and
> another HTML page of the entire formatted manual.
> 
> Can you do this, without resorting to writing Java (and XSP if possible)?
> All of the complicated functionality is present (XML -[XSL]-> result XML
> -[formatter]-> HTML/PDF) but to make several copies of the XML file just
> for the purpose of putting different <?xml-stylesheet?> tags in each one
> seems to defy the whole point of separating the content.
> 
> What's the (official) solution?

Check out cocoon2 and the sitemap. you should be able to do the bulk of
what you're describing right now.

- donald


Re: One XML file -> multiple HTML

Posted by tom stuart <to...@obsess.com>.
On Sun, 23 Apr 2000, Robin Green wrote:
> d96-mst-ingen-reklam@d.kth.se (Mikael St�ldal) wrote:
> >Is it possible to generate several HTML files from one single XML file
> >using Cocoon?
> 
> Yes. This is what dynamic content means.
> What precisely did you want to do?

Well, I'm not sure what Mikael wanted to do, but to follow on with what
might be an illustrative example:

I've got my CV (resume) on my web site, and constantly updating the plain
text, HTML and PDF versions of it is an ongoing nightmare. So, I want to
redo the whole thing in XML/XSL. It would be nice to present a web
interface for generating HTML, plain formatted text, PDF, raw source XML
(you never know) and, say, some alternative HTML documents too (a summary
version, or one with a different layout) from the same source XML content,
just by requesting different URLs.

Or maybe you have a manual contained within one large XML file, and would
like to generate one HTML page with just a generated contents list and
another HTML page of the entire formatted manual.

Can you do this, without resorting to writing Java (and XSP if possible)?
All of the complicated functionality is present (XML -[XSL]-> result XML
-[formatter]-> HTML/PDF) but to make several copies of the XML file just
for the purpose of putting different <?xml-stylesheet?> tags in each one
seems to defy the whole point of separating the content.

What's the (official) solution?

Thanks,
-Tom