cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mariano Kamp <mk...@codamax.com>
Subject [C2] Strange behaviour with XSLT
Date Tue, 03 Jul 2001 11:48:57 GMT
Hi there,

  I got a stylesheet which is working alright, when Xalan is called from the 
command line and when invoked from XSLT-process-mode (emacs).

  When called from cocoon it is acting very strange. All output related to 
"data" is omitted. I double checked a thousand times, that I am working with 
the same files, but this is the case. The only difference between this 
approaches is, that one is called with a static xml file from the command 
line and the other is a transformer within Cocoon2.

  Any thoughts?

Mariano
ps. Again, with cocoon every output related to data is omitted.
Here is the stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:cvis="http://www.codamax.com/vis" 
  <!--  xmlns:sql="http://apache.org/cocoon/SQL/2.0" -->
  <xsl:output indent="yes" method="xml"/>
  

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

  <xsl:template match="cvis:report-definitions">
    <xsl:element name="debug">
      report-definitions called.
    </xsl:element>
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="cvis:report">
    <xsl:element name="debug">
      report called.
    </xsl:element>

    <xsl:element name="html">

      <!-- html document head -->

      <xsl:element name="head">
        <xsl:element name="title">
          <xsl:value-of select="cvis:head/cvis:title"/>
        </xsl:element>
      </xsl:element>


      <!-- html document body -->

      <xsl:element name="body">
	<!-- title line -->
        <xsl:element name="h1">
          <xsl:value-of select="cvis:head/cvis:title"/>
        </xsl:element>

        <xsl:element name="table">
          <xsl:element name="tr">
	    <xsl:for-each select="cvis:head/cvis:column">
	      <xsl:element name="td">
  	        <xsl:value-of select="."/>
              </xsl:element>				 <!-- td -->
            </xsl:for-each>
          </xsl:element>				 <!-- tr   -->					

   	  <!-- data -->
	 <xsl:apply-templates select="data"/>

        </xsl:element>					 <!-- table -->
      </xsl:element>                                     <!-- body -->
    </xsl:element>                                       <!-- html --> 
  </xsl:template>


  <xsl:template match="data">
    <xsl:element name="debug">
      data called.
    </xsl:element>
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="row|cvis:subtotal-row|cvis:total-row">
     <xsl:element name="tr">
       <xsl:apply-templates select="*"/>
     </xsl:element>
  </xsl:template>

  <xsl:template match="row/*">
    <xsl:element name="td">

      <!-- total row -->
      <xsl:if test="parent::total-row">
        <xsl:element name="font">
          <xsl:attribute name="size">+2</xsl:attribute>
        </xsl:element>
      </xsl:if>

      <!-- subtotal row -->
      <xsl:if test="parent::subtotal-row">
        <xsl:element name="font">
          <xsl:attribute name="size">+1</xsl:attribute>
        </xsl:element>
      </xsl:if>


      <xsl:value-of select="."/>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>


Here is the input:

<?xml version="1.0" encoding="ISO-8859-1"?>
<cvis:report-definitions xmlns:cvis="http://www.codamax.com/vis">
  <cvis:report name="pf">
    <cvis:head>
      <cvis:title>
        PortfolioValuation
      </cvis:title>
      <cvis:column>
        <cvis:caption>Land
        </cvis:caption>
        <cvis:dimension name="countries" attribute="name" grouped="yes" 
sorting="ascending"/>
      </cvis:column>
      <cvis:column>
        <cvis:caption>Tageswert
        </cvis:caption>
        <cvis:dimension name="securities" attribute="value" grouped="no" 
sorting="ascending"/>
      </cvis:column>
    </cvis:head>
  <data xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<row>
<c1>AN</c1>
<c2>100.0</c2>
</row>
<row>
<c1>AT</c1>
<c2>100.0</c2>
</row>
<row>
<c1>AU</c1>
<c2>100.0</c2>
</row>
<row>
<c1>BE</c1>
<c2>100.0</c2>
</row>
<row>
<c1>CA</c1>
<c2>100.0</c2>
</row>
<row>
<c1>DE</c1>
<c2>100.0</c2>
</row>
<row>
<c1>DK</c1>
<c2>100.0</c2>
</row>
<row>
<c1>ES</c1>
<c2>100.0</c2>
</row>
<row>
<c1>FI</c1>
<c2>100.0</c2>
</row>
<row>
<c1>FR</c1>
<c2>100.0</c2>
</row>
<row>
<c1>GB</c1>
<c2>100.0</c2>
</row>
<row>
<c1>GR</c1>
<c2>100.0</c2>
</row>
<row>
<c1>IE</c1>
<c2>100.0</c2>
</row>
<row>
<c1>IT</c1>
<c2>100.0</c2>
</row>
<row>
<c1>JP</c1>
<c2>100.0</c2>
</row>
<row>
<c1>KY</c1>
<c2>100.0</c2>
</row>
<row>
<c1>LU</c1>
<c2>100.0</c2>
</row>
<row>
<c1>NL</c1>
<c2>100.0</c2>
</row>
<row>
<c1>NO</c1>
<c2>100.0</c2>
</row>
<row>
<c1>PT</c1>
<c2>100.0</c2>
</row>
<row>
<c1>SE</c1>
<c2>100.0</c2>
</row>
<row>
<c1>US</c1>
<c2>100.0</c2>
</row>
<row>
<c1>XX</c1>
<c2>100.0</c2>
</row>
</data>
</cvis:report>
</cvis:report-definitions>


---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message