Geissel, Adrian wrote:

Silly mail client!


Hi all,

I building an XSP Java logicsheet, and use the following constructs:

   <xsl:template match="*" mode="ctrl-mode">
       <xsp:logic>
           <xsl:apply-templates select="@*" mode="ctrl-mode"/>
           this.contentHandler.startElement(
                     "<xsl:value-of select="namespace-uri(.)"/>",
                     "<xsl:value-of select="local-name(.)"/>",
                     "<xsl:value-of select="name(.)"/>",
                     xspAttr);
           xspAttr.clear();
           <xsl:apply-templates select="text()|*" mode="ctrl-mode"/>
           this.contentHandler.endElement(
                     "<xsl:value-of select="namespace-uri(.)"/>",
                     "<xsl:value-of select="local-name(.)"/>",
                     "<xsl:value-of select="name(.)"/>");
       </xsp:logic>
   </xsl:template>

   <xsl:template match="text()" mode="ctrl-mode">
       <xsp:logic>
                // snip...
       </xsp:logic>
   </xsl:template>

   <xsl:template match="@*" mode="ctrl-mode">
       <!-- Filter out namespace declaration attributes -->
       <xsp:logic>
           tempValue="<xsl:value-of select="."/>";
           // snip...
           xspAttr.addAttribute(
             "<xsl:value-of select="namespace-uri(.)"/>",
             "<xsl:value-of select="local-name(.)"/>",
             "<xsl:value-of select="name(.)"/>",
             "CDATA",
             tempValue
           );
       </xsp:logic>
   </xsl:template>


What I am observing is that the text() nodes are never matched, even thought the source file clearly includes text in the nested elements. Nested elements and attributes are processed as expected.




Has anyone else come across this?
Envronment is standard Cocoon 2.0.4 release running on WL7.0 on Windows NT4
SP6.



IIRC (but don't ask me why), the XSP engine wraps every text node from the XSP file into <xsp:text> elements.


So you may want to match <xsp:text> and not text().

Hope this helps,
Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }




Reply via email to