Hi all.

I am trying to use an XML file, followed by a sequence of two XSL files
in one pipline. The first XSL file contains templates that manipulate
the XML as data; the second file contains templates that format
the resulting data into HTML. The problem is that the resulting
HTML doesn't have all of the markup generated by the templates.

Following is a pared down sample of what I'm trying to do. It
is simply a reworked Hello World app.

Can anyone tell me what I'm doing wrong here? I am new to Cocoon2.
Thanks very much,
Leona Slepetis

Here's the pipeline:
  <map:pipeline>
    <map:match pattern="foo">
      <map:generate src="foo.xml"/>
      <map:transform src="stylesheets/foo1.xsl" type="xslt"/>
      <map:transform src="stylesheets/foo2.xsl" type="xslt"/>
      <map:serialize type="html"/>
    </map:match>
  </map:pipeline>
--------------------------------
The resulting HTML is:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body vlink="blue" link="blue" alink="red" bgcolor="white">
 Hello

  This is my first Cocoon page!

<h1>foo2</h1>
</body>
</html>
---------------------------------
foo.xml:
<?xml version="1.0" encoding="UTF-8"?>
<page>
 <title>Hello</title>
 <content>
  <para>This is my first Cocoon page!</para>
 </content>
</page>
-----------------------------
foo1.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:param name="view-source"/>
  <xsl:template match="page">
    <xsl:copy>
     <xsl:apply-templates/>
     <foo_tag/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
-----------------------------
foo2.xsl:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:param name="view-source"/>

  <xsl:template match="page">
   <html>
    <head>
     <title>
      <xsl:value-of select="title"/>
     </title>
    </head>
    <body bgcolor="white" alink="red" link="blue" vlink="blue">
     <xsl:apply-templates/>
    </body>
   </html>
  </xsl:template>

  <xsl:template match="title">
   <h2 style="color: navy; text-align: center">
      <xsl:if test="not($view-source)">
         <xsl:apply-templates/>
      </xsl:if>
      <xsl:if test="$view-source">
      <A>
         <xsl:attribute name="HREF">../view-source?filename=/<xsl:value-of
select="$view-source"/></xsl:attribute>
    <xsl:attribute name="TARGET">_blank</xsl:attribute>
         <xsl:apply-templates/>
      </A>
      </xsl:if>
   </h2>
  </xsl:template>

  <xsl:template match="para">
   <p align="left">
    <i><xsl:apply-templates/></i>
   </p>
  </xsl:template>


  <xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
  <xsl:template match="text()" priority="-1"><xsl:value-of
select="."/></xsl:template>

  <xsl:template match="foo_tag">
    <h1>foo2</h1>
  </xsl:template>

</xsl:stylesheet>


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

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to