cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MORÁVEK Peter <mora...@pobox.sk>
Subject XSP problem
Date Tue, 29 Feb 2000 16:16:24 GMT
Configuration: WinNT4.0, Apache1.3.9, Apache JServ1.1, Cocoon1.7
(xalan_0_19_3D03.jar).

Hello, 

I'm going to rewrite my CDPProducer to XSP. But I can't get my tag library
to work.
Here are my files:
----------------------------------------------------------------------------
----------
-----------
my.xml
-----------
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<xsp:page 
  language="java"
  xmlns:prefix="http://www.foo.sk/2000/XSP/prefix"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>
  <page>
    <p><prefix:open/></p>
    <p><prefix:close/></p>
  </page>
</xsp:page>

-----------
prefix.xsl
-----------
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:prefix="http://www.foo.sk/2000/XSP/prefix"
>

<xsl:template match="xsp:page">
  <xsp:page>
    <xsl:apply-templates/>
  </xsp:page>
</xsl:template>

<xsl:template match="prefix:open">
  <xsp:expr>in open</xsp:expr>
</xsl:template>

<xsl:template match="prefix:close">
  <xsp:expr>in close</xsp:expr>
</xsl:template>

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

</xsl:stylesheet>

-----------
generated _my.java
-----------
    package _D_._users._web._samples._xsp;

    import java.io.*;
    import java.util.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.apache.cocoon.parser.*;
    import org.apache.cocoon.producer.*;
    import org.apache.cocoon.framework.*;
    import org.apache.cocoon.processor.xsp.*;
    import org.apache.cocoon.processor.xsp.library.*;
    /* User Imports */
    public class _my extends XSPPage {
      /* User Class Declarations */
      public void populateDocument(
        HttpServletRequest request,
        HttpServletResponse response,
        Document document
      )
        throws Exception
      {
	// Node stack logic variables
        Node xspParentNode = null;
        Node xspCurrentNode = document;
        Stack xspNodeStack = new Stack();

	// Make session object readily available
        HttpSession session = request.getSession(false);

        
    xspParentNode = xspCurrentNode;
    xspNodeStack.push(xspParentNode);
    xspCurrentNode =
      document.createElement("page");
    xspParentNode.appendChild(xspCurrentNode);

    
    xspCurrentNode.appendChild(
      document.createTextNode("\n 		")
    );
  
    xspParentNode = xspCurrentNode;
    xspNodeStack.push(xspParentNode);
    xspCurrentNode =
      document.createElement("p");
    xspParentNode.appendChild(xspCurrentNode);

    
    xspParentNode = xspCurrentNode;
    xspNodeStack.push(xspParentNode);
    xspCurrentNode =
      document.createElement("prefix:open");
    xspParentNode.appendChild(xspCurrentNode);

  

    ((Element) xspCurrentNode).normalize();
    xspCurrentNode = (Node) xspNodeStack.pop();
  

    ((Element) xspCurrentNode).normalize();
    xspCurrentNode = (Node) xspNodeStack.pop();
  
    xspCurrentNode.appendChild(
      document.createTextNode("\n 		")
    );
  
    xspParentNode = xspCurrentNode;
    xspNodeStack.push(xspParentNode);
    xspCurrentNode =
      document.createElement("p");
    xspParentNode.appendChild(xspCurrentNode);

    
    xspParentNode = xspCurrentNode;
    xspNodeStack.push(xspParentNode);
    xspCurrentNode =
      document.createElement("prefix:close");
    xspParentNode.appendChild(xspCurrentNode);

    

    ((Element) xspCurrentNode).normalize();
    xspCurrentNode = (Node) xspNodeStack.pop();
  

    ((Element) xspCurrentNode).normalize();
    xspCurrentNode = (Node) xspNodeStack.pop();
  
    xspCurrentNode.appendChild(
      document.createTextNode("\n	")
    );
  

    ((Element) xspCurrentNode).normalize();
    xspCurrentNode = (Node) xspNodeStack.pop();
  
      }
    }

-----------
real output
-----------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
                      "http://www.w3.org/TR/REC-html40/strict.dtd">
<page>
 		<p><prefix:open></prefix:open></p>
 		<p><prefix:close></prefix:close></p>
	</page>

<!-- This page was served in 8562 milliseconds by Cocoon 1.7 -->

-----------
output that I want to gain
-----------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
                      "http://www.w3.org/TR/REC-html40/strict.dtd">
<page>
 		<p>in open</p>
 		<p>in close</p>
	</page>

<!-- This page was served in 8562 milliseconds by Cocoon 1.7 -->

------------------------------------------------------


I think I have something wrong with my namespace "prefix", because when I
remove 
my namespace from the names of the tags (and matching templates), everything
works fine.

Please help

Peter

Mime
View raw message