cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@wkwyw.net>
Subject executing XInclude transformer twice
Date Tue, 06 Aug 2002 17:18:01 GMT
I have a problem with XInclude, however, I may be using the wrong 
solution in the first place, that is perhaps I should be using some 
other mechanism for achieving what I want. So solutions that use a 
technique other than XInclude are welcome.

I have a book written in XML and divided into a number of chapters

introduction.xml
background.xml
casestudies.xml
etc.

Within each chapter I use XInclude to bring some content from other 
files available on a web site, for example, glossary and program code, 
so my pipeline matcher (for pdf output) is:

<map:match pattern="**.pdf">
    <map:generate src="content/xdocs/{1}.xml"/>
    <map:transform type="xinclude"/>
    <map:transform src="skins/saafe/xslt/fo/document2fo.xsl"/>
    <map:serialize type="fo2pdf"/>
</map:match>

This all works fine for individual chapters, but...

To produce the full book, that is a single document with all chapters 
included, I have another xml file (called full.xml) that includes the 
relative portions of the chapter xml files, for example:

<document>
  <header>
     ...
  </header>
  <body>
    <chapter>
      <xi:include href="introduction.xml#xpointer(/document/header)"/>
      <xi:include href="introduction.xml#xpointer(/document/body)"/>
   </chapter>
    <chapter>
      <xi:include href="background.xml#xpointer(/document/header)"/>
      <xi:include href="background.xml#xpointer(/document/body)"/>
   </chapter>
    ...
  </body>
</document>

Predictably, what I get is a document including most of the information 
from the chapter files, but not the included information within each of 
the chapter files. That is, assume background.xml has an xinclude within 
it, this is not translated by the pipeline.

I have tried adding a second xinclude transform the the pipeline:

<map:match pattern="**.pdf">
    <map:generate src="content/xdocs/{1}.xml"/>
    <map:transform type="xinclude"/>
    <map:transform type="xinclude"/>  <!-- second transformation becasue 
included files may have includes -->
    <map:transform src="skins/saafe/xslt/fo/document2fo.xsl"/>
    <map:serialize type="fo2pdf"/>
</map:match>

This generates an error stating that full.xml cannot be found in the 
build directory. I have verified that it is there, and of course it is. 
I don;t think it is a path problem becasue full.xml and all the chapter 
xml files are all in the same directory and all chapters generate OK 
when there is only a single include transformation in the pipeline.

Even if this were to work there would be a problem. What if we needed 
three transformations, or four, or five etc. It is perfectly possible 
for includes to include includes and so on.

Note, I am a relatively competant programmer, so if this is a limitation 
of the XInclude transformer and it is within the specs of XInclude to 
have such recursion I will gladly add it to the transformer.

Thanks for any input,
Ross



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message