[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: many to one OR one to many?

Subject: Re: many to one OR one to many?
From: Fabien Triolet <fabien.triolet@xxxxxxxxxxxx>
Date: Thu, 03 Apr 2003 07:03:51 +0200
xslt many to one
I'm writing the documentation for a tool called Transmorpher and my aim
is to generate a web output (html) and a pdf output  ( for  printing ).

The manual can be described as :

a file (book.xml)

<!DOCTYPE book [
<!ENTITY introduction SYSTEM "intro.xml">
<!ENTITY examples SYSTEM "examples.xml">

]><book>

 &introduction;
 &examples;
....
</book>

that contains others files (chapter) :

<chapter>
 <title>Introduction</title>
  <sect1>
   <title>test</title>
   <para>blablabla</para>
   ...
  </sect1>
 ...
</chapter>

I am using Transmorpher (http://transmorpher.inrialpes.fr) to generate
both html and pdf outputs.
Transmorpher required a file which contains the description of the
transformations to apply on the input files.

For the generation of the documentation, I've created the following
process :

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE transmorpher SYSTEM
"http://transmorpher.inrialpes.fr/dtd/transmorpher.dtd">

<transmorpher    name="Livre" version="1.0"
xmlns="http://transmorpher.fluxmedia.fr/1.0">

    <defextern name="dir"
class="fr.fluxmedia.transmorpher.stdlib.FileIterator"/>
    <defextern name="fop"
class="fr.fluxmedia.tmcontrib.serializer.PDFSerializer"/>


<main name="MyDoc">


<param name="path">../samples</param>

       <generate id="generateXML" type="readfile" out="1">
            <with-param
name="file">${path}/livre/refman/input/Livre.xml</with-param>
        </generate>

<dispatch id="disp" type="broadcast" in="1" out="11 12 13"/>

        <apply-external id="red" in="11" out="2" type="xslt">
            <with-param
name="file">${path}/livre/refman/xslt/LivreFO.xsl</with-param>
        <with-param name="path1">$path</with-param>
        </apply-external>

        <!-- <dispatch id="disp" type="broadcast" in="2" out="3 4"/> -->
        <serialize id="output" type="fop" in="2">
            <with-param
name="file">${path}/livre/refman/output/pdf/refman.pdf</with-param>
            <with-param name="format">pdf</with-param>
        </serialize>

        <!-- <serialize id="output" type="writefile" in="4">
            <with-param
name="file">../samples/livre/output/livre.fo</with-param>
            <with-param name="method">xml</with-param>
            <with-param name="indent">yes</with-param>
        </serialize> -->

        <apply-external id="red" in="12" out="3" type="xslt">
            <with-param
name="file">${path}/livre/refman/xslt/LivreHTML.xsl</with-param>
        </apply-external>

        <serialize id="output" type="writefile" in="3">
            <with-param
name="file">${path}/livre/refman/output/html/index.html</with-param>
            <with-param name="method">html</with-param>
            <with-param name="indent">yes</with-param>
        </serialize>

<repeat id="rep" in="13" bin="OO" out="OO">

        <with-param name="path1">$path</with-param>
            <!-- gets all the xml files in chapters/ . At each loop, a
parameter "name" is given to
            the processes that are in the repeat body. The value of this
parameter is the current file name.-->
          <iterate type="dir" name="name">
                <with-param
name="dir">../samples/livre/refman/input/chapters</with-param>
                <with-param name="filter">xml</with-param>
                <with-param name="recursive">no</with-param>
                <with-param name="sort">true</with-param>
            </iterate>

        <!-- Due to the current implementation of the repeat component,
repeat can' t be created without
        input and output. The following process is added to allow the
creation of this repeat-->

        <apply-external id="red" in="13" out="OO" type="xslt">
            <with-param
name="file">${path1}/livre/refman/xslt/chapitreHTML.xsl</with-param>
        </apply-external>

        <!-- useful part of the repeat process : transforms all the xml
files in html files -->
        <!-- reads the current file -->
        <generate id="generateXML" type="readfile" out="O1">
            <with-param name="file">$name</with-param>
        </generate>

        <apply-external id="red" in="O1" out="O2" type="xslt">
            <with-param
name="file">${path1}/livre/refman/xslt/chapitreHTML.xsl</with-param>
        </apply-external>

        <serialize id="output" type="writefile" in="O2">
            <with-param
name="file">${path1}/livre/refman/output/html/${name}</with-param>
            <with-param name="method">xml</with-param>
            <with-param name="format">html</with-param>
            <with-param name="standalone">no</with-param>
            <with-param name="encoding">iso-8859-1</with-param>
            <with-param name="indent">yes</with-param>
        </serialize>
        </repeat>

        <!-- The output of the repeat is useless. So we don't write
anything-->
        <serialize id="output" type="writefile" in="OO" file="_null_">
        </serialize>

    </main>
</transmorpher>

to process the transformation, just type :
java -jar PATHTOTRANSMORPHER/lib/transmo.jar process.xml

Transmorpher is provided with some examples. See the music-collection
sample in which one xml source file
is cut into several files.

Fabien TRIOLET
--------------------------
INRIA Rhone-Alpes, FRANCE



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.