cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <Scott_B...@lotus.com>
Subject Re: XSLT induced hair loss.
Date Mon, 03 Jul 2000 02:53:44 GMT

Paul, your problem is with the default namespace decl:  xmlns="
http://apache.org/cocoon/status".  This means the name "statusinfo" is
really something like "http://apache.org/cocoon/status#statusinfo", if you
get what I mean.  So, match="statusinfo" never matches, and it falls back
to the default templates, which correctly produce your result.  You need to
do something like:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:cocoon-status="
http://apache.org/cocoon/status"
                              xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="cocoon-status:statusinfo">
        <html>
        </html>
    </xsl:template>
</xsl:stylesheet>

Please note that the default namespace is not used in xpaths.  So, you can
NOT do:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns="http://apache.org/cocoon/status"
                              xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="statusinfo">
        <html>
        </html>
    </xsl:template>
</xsl:stylesheet>

-scott




                                                                                         
                                    
                    Paul Russell                                                         
                                    
                    <paul@luminas.co.uk>            To:     cocoon-dev@xml.apache.org
                                        
                    Sent by: Paul Russell           cc:     (bcc: Scott Boag/CAM/Lotus)  
                                    
                    <paulr@luminas.penguinpo        Subject:     XSLT induced hair loss.
                                     
                    wered.com>                                                        
                                       
                                                                                         
                                    
                                                                                         
                                    
                    07/02/2000 06:46 PM                                                  
                                    
                    Please respond to                                                    
                                    
                    cocoon-dev                                                           
                                    
                                                                                         
                                    
                                                                                         
                                    



Hi Guys.

Need you to help me confirm I'm not (a) insane or (b) stupid.

I'm writing a custom generator for Cocoon2 to produce status
info (ala Cocoon1's /Cocoon.xml).

The producer produces:

<?xml version="1.0"?>

<statusinfo date="Jul 2, 2000 10:42:03 PM" host="test.stu.uea.ac.uk"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns="http://apache.org/cocoon/status">
    <group name="vm">
        <group name="memory">
               <value name="total">3362808</value>
               <value name="free">937072</value>
           </group>
           <group name="jre">
               <value name="version">1.2.2</value>
               <value xlink:type="simple"
                   xlink:href="http://java.sun.com/"
                     name="java-vendor">Sun Microsystems Inc.</value>
        </group>
           <group name="operating-system">
               <value name="name">Linux</value>
               <value name="architecture">i386</value>
               <value name="version">2.4.0-test1</value>
           </group>
           <value name
="classpath">.:./bin/../lib/ant.jar:./bin/../lib/cocoon-latest.jar:./bin/../lib/fop_0_13_0.jar:./bin/../lib/jasper.jar:./bin/../lib/js.jar:./bin/../lib/jstyle.jar:./bin/../lib/servlet.jar:./bin/../lib/servlet_2_2.jar:./bin/../lib/stylebook-1.0-b2.jar:./bin/../lib/svgv_0_8.jar:./bin/../lib/test:./bin/../lib/webserver.jar:./bin/../lib/xalan_1_0_1.jar:./bin/../lib/xerces_1_1_2.jar:./bin/../lib/xml.jar:/usr/local/jdk1.2.2/lib/tools.jar:/usr/share/java/repository:/usr/local/jdk1.2.2/lib/tools.jar:/usr/share/java/xalan.jar:/usr/share/java/xerces.jar:/usr/share/java/cocoon.jar:/usr/share/java/fop.jar</value>

    </group>
</statusinfo>

The stylesheet is the oh-so-involved:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="statusinfo">
        <html>
        </html>
    </xsl:template>
</xsl:stylesheet>


The output is:

<?xml version="1.0"?>
33095605308961.2.2Sun Microsystems
Inc.Linuxi3862.4.0-test1.:./bin/../lib/ant.jar:./bin/../lib/cocoon-latest.jar:./bin/../lib/fop_0_13_0.jar:./bin/../lib/jasper.jar:./bin/../lib/js.jar:./bin/../lib/jstyle.jar:./bin/../lib/servlet.jar:./bin/../lib/servlet_2_2.jar:./bin/../lib/stylebook-1.0-b2.jar:./bin/../lib/svgv_0_8.jar:./bin/../lib/test:./bin/../lib/webserver.jar:./bin/../lib/xalan_1_0_1.jar:./bin/../lib/xerces_1_1_2.jar:./bin/../lib/xml.jar:/usr/local/jdk1.2.2/lib/tools.jar:/usr/share/java/repository:/usr/local/jdk1.2.2/lib/tools.jar:/usr/share/java/xalan.jar:/usr/share/java/xerces.jar:/usr/share/java/cocoon.jar:/usr/share/java/fop.jar


... which I can't work out at *all*.

I was expecting the somewhat more mundane:

<html>
</html>

Has anyone got any ideas? I can't work out whether this is a
bug (in Xalan), or whether I've left my brain somewhere
embarasing this evening! Heeeeelp!

Cheers,

Paul

--
Paul Russell                               <paul@luminas.co.uk>
Technical Director,                   http://www.luminas.co.uk
Luminas Ltd.





Mime
View raw message