You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Oliver Gries <gr...@java-concepts.com> on 2001/02/09 18:37:15 UTC

including external documents at xslt processing time

Hi cocoon users,

I'm trying  now for severall weeks to solve this simple problem but I 
couldn't find a solution so far. I allready scanned the faq and archived 
mailing list from october and november 2000 but allthough there were 
simular issues discussed, none of them could give me the answer.

What I want to do is quite simple and I appologize if this sounds quite 
familiar to you from other postings.

My question is:

Is there a way to include external sources served either as static HTML 
from a file or from other XML processed documents during one xslt 
processing step of a xml document?

Example:
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?cocoon-process type="xinclude"?>
<?xml-stylesheet href="mainstyle.xsl" type="text/xsl"?>

... XML File ...
<workflow>
         .... XSP stuff ....
       <category name="Documents">
               <content href="documents.xml"/>
       </category>
       <category name="References">
                <content href="refs.html"/>
       </category>
       .... other XML stuff
<workflow>

... Stylesheet mainstyle.xsl....

<xsl:template match="category">
       <TABLE>
               <TR>
                       <TD>
                               <xsl:value-of select="./@name"/>
                        </TD>
               </TR>
               <TR>
                       <TD>
                           ????? How do I get at this position the HTML 
output from the
                                       <xsl:value-of 
select="./content/@href">                               
                                      link ?????
                        </TD>
               </TR>
       </TABLE>
</xsl:template>


What I did so far:

I got a web-workflow.xml file with defines the general flow througout my 
web application. There are several categories and subcatogires, 
references and so on defined representing the context of each page. So, 
each category node has a content node with a HREF link attribute (URL).

This URL can either consist of HTML or other XML pages which needed to 
get processed for proper output.

The only solution I could found so far is, that the main stylesheet 
which is directly associated to the workflow.xml file produces a 
FRAMESET HTML document whereby the SRC of each frame is the standard 
context + main menu ( a link to the workflow.xml again with different 
targets) and the content document link.

This works fine appart from the very bad performence. Because there are 
at least 4 individual processing calls for one page call (because of the 
individual frames).

A better solution for me would be just to generate on big table and 
include the document from the link in one table cell. This is OK for the 
menu stuff, but doesn't work for the content page.

I allready tried:


(1) <xsl:apply-templates select="document("example.*")"/>
- if example is an xml file with processing instructions they will not 
be executed
- if example is a html file the html code will be show as output (the 
&lt; problem within xml tags)
(2) <xinclude:include href="example.*">
- xinclude doesn't work during xslt processing (ist this right ??)

(.* means *.xml or  *.html or any other)

So what I'm trying now is, to generate <xinclude> statements at the 
appropriate position during the xslt process and pass this by cocoon to 
the XInclude processor. This should hopefully work by adding the 
<?cocoon-process type="xinclude"?> PI after the xslt PI (see xml example).

If I unerstand the concept of the PI order right, this should actually 
work, but it doesn't. The <xinclude> just gets unprocessed into the 
output HTML code.

Sorry for this long mail, but I thought it's the best the explain it right.

I use cocoon1.8 on apache/jserv with suse linux 7.0.

Any suggestions or links to the appropriate sources would be appricated.

Thanks in advance
Oliver