cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JEULIN Olivier <olivier.jeu...@xml-ais.com>
Subject [C1] xinclude tags not processed if called inside a taglib (3 ste ps approach)
Date Tue, 29 May 2001 10:27:07 GMT
Hello,
I'm trying to use a custom taglib to include (parts of) xml files.
My goal is to achieve a complete separation between xml sources, xsp which
merge them, and further XSLT/XSL processing. I would also like to have all
"cocoon-process" instructions grouped in the xsp file.

If I uncomment my tag "toto:title" and the call to xsp and its stylesheet,
xinclude instructions work fine.
But, if I put them back, xinclude instuctions are left as is (but Xinclude
seems to be call, as it inserts a comment: "processed by XInclude" !?). (see
attached html files)

I have tried to insert <?cocoon-process type="xinclude"?> dynamicaly in the
xsp:page template: it doesn't work either.

What's the correct way to do it ?

(Im using cocoon 1.8.2 and tomcat 3.2.1-1)

Here are my 3 files:

############################## index.xml ##############################

<?xml version="1.0" encoding="ISO-8859-1"?>

<?cocoon-process type="xsp"?>
<?xml-logicsheet href="logic.xsl"?>

<?cocoon-process type="xinclude"?>

<?cocoon-process type="xslt"?>
<?xml-stylesheet href="pages.xsl" type="text/xsl"?>

<xsp:page
  xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:toto="http://localhost/toto">
<page>  
  <toto:title/>
    <table border="1">
	<tr>
	  <td>
	    <foo xinclude:href="menu.xml" xinclude:parse="xml"/>
	  </td>
	  <td>
	    <bar xinclude:href="fragment.xml#xpointer(//content)"
xinclude:parse="xml"/>
	  </td>
	</tr>
    </table>
  <footer/>
</page>
</xsp:page>

############################ logic.xsl ###############################

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
   xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
   xmlns:toto="http://localhost/toto">

<xsl:template match="xsp:page">
 <xsl:copy>
  <xsl:apply-templates select="@*"/>
  <xsl:apply-templates/>
 </xsl:copy>
</xsl:template> 

<xsl:template match="toto:title">
  <title>
    <foo xinclude:href="fragment.xml#xpointer(//title)"
xinclude:parse="xml"/>
  </title>
</xsl:template>

<xsl:template match="@*|node()|comment()|processing-instruction()|text()"
priority="-1">
  <xsl:copy>
    <xsl:apply-templates
select="@*|node()|comment()|processing-instruction()|text()"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

############################## pages.xsl #########################

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <html>
      <body>
        <xsl:apply-templates/>	
      </body>
    </html>
</xsl:template>

<xsl:template match="title">
  <h1>TITLE [<xsl:apply-templates/>]</h1>
</xsl:template>

<xsl:template match="menu">
  <h2>MENU</h2>
  <p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="content">
  <h2>CONTENT</h2>
  <p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="footer">
  <i>FOOTER</i>
</xsl:template>

<xsl:template match="@*|*|comment()|processing-instruction()|text()">
  <xsl:copy>
    <xsl:apply-templates
select="@*|*|comment()|processing-instruction()|text()"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>


Mime
View raw message