Hi Rachid,
Aha, becoming a bit clearer. You are reading the HTML, distilling XML and XSL's
out of it, applying the XSL's to the XML and producing XSL-FO all in one
generator?
If your WH2FO parser is XSLT based, you can use Cocoon piping to connect it all
together and skip manual file and buffer writing. You would need something like:
- One pipe to consume the HTML using the Jtidy generator
- Three pipes that produce the XML, XSL 1 and XSL 2 respectively, using the
first pipe
(the first pipe will be executed only once thanks to the Cocoon internal
caching mechanism)
- One pipe to get the XML and apply the two XSL's
- One pipe to get the result and apply FOP serializer if appropriate
Most tricky part is the pipe before the last, though not that complex either.
It could look like:
<map:match pattern="apply-stylesheets/**"> <!-- ** represents path
to html file -->
<map:generate src="cocoon:/get-xml/{1}" /> <!-- call to pipeline
that converts html to xml -->
<map:transform src="cocoon:/get-first-xsl/{1}" />
<map:transform src="cocoon:/get-second-xsl/{1}" />
<map:serialize type="xml" />
</map:match>
Implementing the above gives you separate pipes for the three files: xml, xsl 1
and xsl 2, an additional pipe to read any HTML file, a pipe to connect the
three files to create XSL-FO, and as many additional pipes as you like to
serialize the XSL-FO to as many formats as you like (or supported).
Does this help?
Kind regards,
Geert
> -----Oorspronkelijk bericht-----
> Van: rachid harradi [mailto:[EMAIL PROTECTED]
> Verzonden: maandag 25 september 2006 16:38
> Aan: [email protected]
> Onderwerp: Re: RE: RE: HTMLGenerator generate Tree Files
>
> Hello together,
>
> I will procude a XSLT and/or a XSL:FO on the basis WordHTML.
> for it I found a TOOL names WH2FO, which procudes three
> files(.xml, .xsl(1), .xsl(2)).
> I would like to use this Framework in cocoon. So the xml File like:
>
> <paragraph class="Normal">
> <reference id="Name_Einreicher"></reference>
>  
>  
> ::woh_lastname , ::woh_firstname
> </paragraph>
>
>
> with xsl(3) I want to replace the value like ::woh_lastname
> with other values(from another xml document(dynamic)).
> at end i want the resulting document through xsl(1,2) in HTML or pdf
>
> i hoffe thas you unterstand what i want to do
>
>
> Rachid Harradi
> -------- Original-Nachricht --------
> Datum: Mon, 25 Sep 2006 16:02:41 +0200
> Von: "Geert Josten" <[EMAIL PROTECTED]>
> An: [email protected]
> Betreff: RE: RE: HTMLGenerator generate Tree Files
>
> > Hi Rachid,
> >
> > I have the impression that you have coded more in Java than
> necessary.
> > Can you summarize briefly what you try to achieve in
> functional terms
> > and why you have chosen to write this generator?
> >
> > Kind regards,
> > Geert
> >
> > > -----Oorspronkelijk bericht-----
> > > Van: rachid harradi [mailto:[EMAIL PROTECTED]
> > > Verzonden: maandag 25 september 2006 15:46
> > > Aan: [email protected]
> > > Onderwerp: Re: RE: HTMLGenerator generate Tree Files
> > >
> > > Hello Josten,
> > >
> > >
> > > my Generator "generator":
> > >
> > > public void generate()
> > > throws IOException, SAXException, ProcessingException {
> > >
> > > SAXParser parser = null;
> > >
> > > try {
> > > boolean debug = false;
> > > boolean info = false;
> > > boolean ascii = false;
> > > boolean toc = false;
> > >
> > > ascii = true;
> > > String target
> > > ="E:/workspace3/cocoon/build/webapp/wh2fo/objectionhtml.html";
> > > File source = new File(target);
> > > if (source.exists())
> > > {
> > > translator.doXslAttsFileName(target);
> > > translator.doXmlFileName(target);
> > > translator.doXslFileName(target);
> > > String xslFileName=
> translator.getXslFileName();
> > > String xslAttsFileName =
> > > translator.getXslAttsFileName();
> > > String xmlFileName =
> > > translator.getXmlFileName();
> > > String producer = Version.producer;
> > >
> > > documentParser = new DocumentParser(
> > > target,xslAttsFileName,xmlFileName,debug,ascii,toc);
> > > ElementTreeWriter XSLTempWriter = new
> > > ElementTreeWriter(xslFileName, producer);
> > > // 1er file bestored.
> > > //in "E:/workspace3/cocoon/build/webapp/wh2fo/"
> > > //to another pipeline
> > >
> > > XSLTempWriter.write(documentParser.getXSLTemplatesRoot());
> > > // // 1er file be stored in
> > > "E:/workspace3/cocoon/build/webapp/wh2fo/"
> > > ElementTreeWriter XSLAttsWriter = new
> > > ElementTreeWriter(xslAttsFileName, producer);
> > >
> > > XSLAttsWriter.write(documentParser.getXSLAttributesRoot());
> > > ElementTreeWriter XMLwriter = new
> > > ElementTreeWriter(xmlFileName, producer);
> > >
> > > XMLwriter.write(documentParser.getXMLPreProc());documentParser
> > > =translator.getParser();
> > >
> > >
> > >
> > > StringReader xmlReader = new
> > > StringReader(XMLwriter.getBuffer().toString());
> > > inputSource = new
> InputSource(xmlReader);
> > >
> > > parser =
> > > (SAXParser)this.manager.lookup(SAXParser.ROLE);
> > > parser.parse(this.inputSource,
> super.xmlConsumer);
> > >
> > > }
> > > else System.err.println("SEVERE ERROR:
> file "+target+" not
> > > found.");
> > > } catch (IOException e) {
> > > getLogger().error("StreamGenerator.generate()", e);
> > > throw new
> > > ResourceNotFoundException("StreamGenerator could not find
> resource",
> > > e);
> > > }
> > > catch (Exception e) {
> > > getLogger().error("Could not get parser", e);
> > > throw new ProcessingException("Exception in
> > > StreamGenerator.generate()", e);
> > > } finally {
> > > this.manager.release( parser);
> > > }
> > > }
> > > -------- Original-Nachricht --------
> > > Datum: Mon, 25 Sep 2006 14:11:00 +0200
> > > Von: "Geert Josten" <[EMAIL PROTECTED]>
> > > An: [email protected]
> > > Betreff: RE: HTMLGenerator generate Tree Files
> > >
> > > > Can you give more details on how the generator produces
> the three
> > > > files exactly?
> > > >
> > > > Kind regards,
> > > > Geert
> > > >
> > > > >
> > > >
> > > >
> > > > Drs. G.P.H. Josten
> > > > Consultant
> > > >
> > > >
> > > >
> > > > Daidalos BV
> > > > Source of Innovation
> > > > Hoekeindsehof 1-4
> > > > 2665 JZ Bleiswijk
> > > > Tel.: +31 (0) 10 850 1200
> > > > Fax: +31 (0) 10 850 1199
> > > > www.daidalos.nl
> > > > KvK 27164984
> > > >
> > > >
> > > > De informatie - verzonden in of met dit emailbericht - is
> > > > afkomstig van Daidalos BV en is uitsluitend bestemd
> voor de geadresseerde.
> > > > Indien u dit bericht onbedoeld hebt ontvangen, verzoeken
> > > wij u het te
> > > > verwijderen. Aan dit bericht kunnen geen rechten worden
> ontleend.
> > > >
> > > >
> > > > > Van: rachid harradi [mailto:[EMAIL PROTECTED]
> > > > > Verzonden: maandag 25 september 2006 13:45
> > > > > Aan: [email protected]
> > > > > Onderwerp: HTMLGenerator generate Tree Files
> > > > >
> > > > > Hello Together,
> > > > >
> > > > >
> > > > > I have generator, which procudes three files(.xml,
> .xsl, .xsl).
> > > > > I would like to send this tree files on differently pipeline.
> > > > > how i can do it?
> > > > > --
> > > > > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten
> > > zu sparen!
> > > > > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> > > > >
> > > > >
> > >
> --------------------------------------------------------------------
> > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > >
> --------------------------------------------------------------------
> > > -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > --
> > > NEU: GMX DSL Sofort-Start-Set - blitzschnell ins Internet!
> > > Echte DSL-Flatrate ab 0,- Euro* http://www.gmx.net/de/go/dsl
> > >
> > >
> --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> NEU: GMX DSL Sofort-Start-Set - blitzschnell ins Internet!
> Echte DSL-Flatrate ab 0,- Euro* http://www.gmx.net/de/go/dsl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]