That's an XSLT question rather than an XSL-FO question. XSLT can solve 
this problem with the document function, thus:

Use a for-each to read each document spec in the configuration file. For 
each doc spec, read the referenced document and copy it to the result 
tree.

Something like this (assuming you want the XML file specified by the 
Document element):

<xsl:template match="/*|text()|@*">
  <xsl:for-each select="document('conffile.xml')/Lesson/Document">
    <xsl:copy-of select="document(@uri)/*">
  </xsl:for-each>
</xsl:template>

If you want all three XML files in each Lesson element:

<xsl:template match="/*|text()|@*">
  <xsl:for-each select="document('conffile.xml')/Lesson">
    <xsl:copy-of select="document(Document/@uri)/*"/>
    <xsl:copy-of select="document(Exercises/@uri)/*">
    <xsl:copy-of select="document(ScormBlocco/@uri)/*">
  </xsl:for-each>
</xsl:template>


I was going to say I hadn't tested it, but I took the time (not much - it 
has taken me longer to write this message) to write and test (with Saxon 
8) a small set of files that illustrate the technique:

Configuration file (conffile.xml):

<files>
  <file uri="file1.xml"/>
  <file uri="file2.xml"/>
</files>

file1.xml:

<document>
  <level1 level="1">
    <level2 level="2">A</level2>
  </level1>
  <level1 level="1">
    <level2 level="2">B</level2>
    <level2 level="2">C</level2>
  </level1>
</document>

file2.xml

<document>
  <level1 level="1">
    <level2 level="2">D</level2>
  </level1>
  <level1 level="1">
    <level2 level="2">E</level2>
    <level2 level="2">F</level2>
  </level1>
</document>

XSL file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:template match="/">
    <document>
      <xsl:for-each select="document('conffile.xml')/files/file">
        <xsl:copy-of select="document(@uri)/document/*"/>
      </xsl:for-each>
    </document>
  </xsl:template>

</xsl:stylesheet>

The result (with some formatting for readibility):

<?xml version="1.0" encoding="UTF-8"?>
<document>
  <level1 level="1">
    <level2 level="2">A</level2>
  </level1>
  <level1 level="1">
    <level2 level="2">B</level2>
    <level2 level="2">C</level2>
  </level1>
  <level1 level="1">
    <level2 level="2">D</level2>
  </level1>
  <level1 level="1">
    <level2 level="2">E</level2>
    <level2 level="2">F</level2>
  </level1>
</document>

A couple things to note: I put in the attributes just to make sure that 
attributes would be copied correctly. Obviously, they are redundant and 
useless for any real purpose. The important note is how I handled the 
<document> element in each source file. Had I not written a literal result 
element (<document>) around the for-each and had I used <xsl:copy-of 
select="document(@uri)/*"/>, I would have wound up with a file like this:

<document><!--contents here --></document>
<document><!--contents here --></document>

Since only one element can be present at the root level of an XML file, 
that would be a bad result.

I do similar things all the time, usually to interweave elements from two 
different documents or to compare documents.

HTH

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




"Tommaso Taglioni" <[EMAIL PROTECTED]> 
02/24/2005 08:29 AM
Please respond to
[EMAIL PROTECTED]


To
<[EMAIL PROTECTED]>
cc

Subject
N xml, 1 PDF






Hi all,

I have some XML file and I have to make only one PDF of them.

I have also a configuration file that have the order and the names of the
XML.

The structure of the configuration file is like this:



<Module number="6">

     <Lesson>

          <Document uri="xml\1concettibase.xml"/>

          <Exercises uri="xml\Domande1.xml"/>

          <ScormBlocco uri="xml\1concettibase_SCORM-MANIFEST.xml"/>

     </Lesson>

     <Lesson>

          <Document uri="xml\2audio.xml"/>

          <Exercises uri="xml\Domande2.xml"/>

          <ScormBlocco uri="xml\2audio_SCORM-MANIFEST.xml"/>

     </Lesson>

.

.

.

.

     <Objective uri="xml\obiettivi.xml">

      <ScormBlocco uri="xml\obiettivi_SCORM-MANIFEST.xml"/>

     </Objective>

     <Video uri=""/>

     <Bibliography uri="xml\bibliografia.xml">

      <ScormBlocco uri="xml\obiettivi_SCORM-MANIFEST.xmll"/>

     </Bibliography>

</Module>



I have to bypass all concerns to SCORM and video, because obviously I 
don't
need in the PDF.

Is this all possible using FOP?How?



Tommaso


---------------------------------------------------------------------
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]

Reply via email to