cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject RE: [C2] Trouble with <xsp:include> tags in my taglib
Date Tue, 24 Oct 2000 13:55:20 GMT
Fred,

There were problems in copying attributes also.

//////////////////////////////////////////////////////////
// Here's the taglib that works.
//////////////////////////////////////////////////////////

<?xml version="1.0"?>

<xsl:stylesheet
  version="1.0"
  xmlns:message="http://www.altacast.com/xsp/message"
  xmlns:xsp="http://apache.org/xsp"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

  <xsl:template match="xsp:page">
    <xsl:copy><!--copy node being visited-->
      <xsl:copy-of select="@*"/><!--copy of all attributes-->
      <xsp:structure>
        <xsp:include>com.altacast.louis.LouisManager</xsp:include>
      </xsp:structure>
      <xsl:apply-templates/><!--process the children-->
    </xsl:copy>
  </xsl:template>

  <!-- hello -->
  <xsl:template match="message:hello">
    Hello, World!
  </xsl:template>

  <xsl:template name="get-nested-content">
    <xsl:param name="content"/>
    <xsl:choose>
      <xsl:when test="$content/*">
        <xsl:apply-templates select="$content/*"/>
      </xsl:when>
      <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
    </xsl:choose>
  </xsl:template>
 
  <xsl:template match="@*|*|text()|processing-instruction()">
    <xsl:copy>
      <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Thanks,
dims

--- Sebastien Sahuc <ssahuc@imediation.com> wrote:
> Please be careful with namespace declaration !!!
> 
> your built-in logicsheet is declaring xsp prefix with the URI
> 'http://xml.apache.org/xsp' whereas it should have been associated with the
> URI 'http://apache.org/xsp'. 
> 
> This fully explains the strange behavior you're experiencing. :-)
> 
> But I don't blame you since we've changed the URIs not a long time ago. And
> this can be error prone, that's why we now ended up with the final URI. At
> least I hope so :-)
> 
> All the best,
> 
> Sebastien
> 
> 
> 
> > -----Original Message-----
> > From: Lock, Fred [mailto:flock@gohealthcast.com]
> > Sent: Friday, October 20, 2000 7:30 PM
> > To: 'cocoon-dev@xml.apache.org'
> > Subject: [C2] Trouble with <xsp:include> tags in my taglib
> > 
> > 
> > I'm having trouble with the <xsp:structure> and <xsp:include> 
> > tags under C2.
> > The trouble is that when I look in the repository at the 
> > generated java
> > class file for my xsp, the required import statement is not included.
> > 
> > It's as if C2 applies xsp.xsl to the xsp page before applying 
> > my custom
> > taglib. I say this because if I put the <xsp:structure> and 
> > <xsp:include>
> > tags in the xsp itself, then cocoon generates the import 
> > statement in the
> > output java class. However, I don't want to do this in the 
> > xsp. I don't want
> > my xsp's to have to know what they need to import.
> > 
> > Any suggestions? The code that does not generate the import 
> > statement is
> > included below.
> > 
> > Fred J. Lock
> > Lead Developer
> > HealthCast, LLC
> > www.gohealthcast.com
> > 
> > //////////////////////////////////////////////////////////
> > // Here's my xsp:
> > //////////////////////////////////////////////////////////
> > 
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > 
> > <xsp:page
> >   language="java"
> >   xmlns:xsp="http://apache.org/xsp"
> >   xmlns:message="http://www.altacast.com/xsp/message"
> > >
> >   <page>
> >     <greeting>
> >       <message:hello/>
> >     </greeting>
> >   </page>
> > </xsp:page>
> > 
> > //////////////////////////////////////////////////////////
> > // Here's my taglib:
> > //////////////////////////////////////////////////////////
> > 
> > <?xml version="1.0"?>
> > 
> > <xsl:stylesheet
> >   version="1.0"
> >   xmlns:message="http://www.altacast.com/xsp/message"
> >   xmlns:xsp="http://xml.apache.org/xsp"
> >   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > >
> > 
> >   <xsl:template match="xsp:page">
> >     <xsp:page>
> > 
> >       <!-- This should generate an import in the output java 
> > class, -->
> >       <!-- but it doesn't -->
> >       <xsp:structure>
> >         <xsp:include>com.altacast.louis.LouisManager</xsp:include>
> >       </xsp:structure>
> > 
> >       <xsl:copy>
> >         <xsl:apply-templates select="@*"/>
> >       </xsl:copy>
> > 
> >       <xsl:apply-templates/>
> > 
> >     </xsp:page>
> >   </xsl:template>



=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

Mime
View raw message