[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] how don't show the content of an element


Subject: [xsl] how don't show the content of an element
From: "Ana Yndurain" <yndu@xxxxxxxxxxxx>
Date: Fri, 22 Jul 2005 11:24:36 +0200

Hi!

I have an xsl that shows some content that I doesn't want. In my XSL I call
some templates, and just after execute template "metricascomprobadas" when
is going to execute template "listametricas" it show de content of the
elements Metrics/Cycle/Package and I don't know why.
In that example it shows:

es.m.p.bu.vo
es.m.p.ws
es.m.p.bu.ma
es.m.p.bu.ex

es.m.p.ma
es.m.p.ma.tr
es.m.p.ma.psp

Could yoy give me any idea?

Here I write my XSL and the structure of my XML (given by Metrics 1.3.5)

Thanks! 
Ana

----------------------------------------------------------------------------
The XSL is something like that:
----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"  
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:m="http://metrics.sourceforge.net/2003/Metrics-First-Flat">
  
  <!-- NODO RAIZ -->
  <xsl:template match="/">
    <html>  
      <head>
        <title>
          <!-- EJECUTA LA PLANTILLA CABECERA -->
          <xsl:apply-templates mode="cabecera"/>
        </title>
      </head>
      <body>
        <a name="top"/>        
        <hr size="1" width="100%" align="left"/>
        <!-- EJECUTA LA PLANTILLA METRICASCOMPROBADAS -->
        <xsl:apply-templates mode="metricascomprobadas"/>
        <hr size="1" width="100%" align="left"/>
        <!-- EJECUTA LA PLANTILLA LISTAMETRICAS -->
        <xsl:apply-templates mode="listametricas"/>        
        
      </body>
    </html>
  </xsl:template>
  
  
  <!-- PLANTILLA CABECERA -->
  <xsl:template match="m:Metrics" mode="cabecera"> 
    Metricas del proyecto:<xsl:value-of select="@scope"/>
  </xsl:template>
 
  <!-- PLANTILLA METRICASCOMPROBADAS -->
  <xsl:template match="m:Metrics" mode="metricascomprobadas">
    <h3>proyecto <xsl:value-of select="@scope"/></h3>
    <table class="log" border="0" cellpadding="5" cellspacing="2" 
	 width="100%">
      <tr>
        <th>Metrica</th>
        <th>Descripcion</th>
        <th>Fuera de rango</th>
      </tr>
      <xsl:for-each select="m:Metric">
        <xsl:sort select="count(m:Values/m:Value[@inrange='false'])" 
		data-type="number" order="descending"/>
        <tr>
          <xsl:call-template name="alternated-row"/>
          <td>
            <a href="#f-{@id}">
              <xsl:value-of select="@id"/>
            </a>
          </td>
          <td>
            <xsl:value-of select="@description"/>
          </td>
          <td>
            <xsl:value-of
select="count(m:Values/m:Value[@inrange='false'])"/> de <xsl:value-of
select="count(m:Values/m:Value)"/>
          </td>
        </tr>
      </xsl:for-each>
    </table>
  </xsl:template>
  
  
  <!-- PLANTILLA LISTAMETRICAS -->
  <xsl:template match="m:Metric" mode="listametricas">    
    <a name="f-{@id}"/>    
    <h3><xsl:value-of select="@id"/> (<xsl:value-of
select="@description"/>)</h3>
    
	[...... AND MORE LINES ........]
    
  </xsl:template>
  
  
  <!-- PLANTILLA QUE PONE CADA FILA DE LA TABLA DE UN COLOR -->
  <xsl:template name="alternated-row">
    <xsl:attribute name="class">
      <xsl:if test="position() mod 2 = 1">a</xsl:if>
      <xsl:if test="position() mod 2 = 0">b</xsl:if>
    </xsl:attribute>
  </xsl:template>
</xsl:stylesheet>

----------------------------------------------------------------------------
The XML is something like that:
----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Metrics scope="p" type="Project" date="2005-07-20"  
         xmlns="http://metrics.sourceforge.net/2003/Metrics-First-Flat">

<Cycle name="es.m.p.bu.vo et al" nodes="4" diameter="3">
  <Package>es.m.p.bu.vo</Package>
  <Package>es.m.p.ws</Package>
  <Package>es.m.p.bu.ma</Package>
  <Package>es.m.p.bu.ex</Package>
</Cycle>

<Cycle name="es.pr.m.p.ma et al" nodes="3" diameter="2">
  <Package>es.m.p.ma</Package>
  <Package>es.m.p.ma.tr</Package>
  <Package>es.m.p.ma.psp</Package>
</Cycle>

<Metric id = "NSM" description ="Number of Static Methods">
 <Values per = "type" total = "20" avg = "0,278" stddev = "0,961" max = "7">
 <Value name="aa" source ="a.java" package ="es.m.p.bu.dao" value ="0"/>
 <Value name="bb" source ="b.java" package ="es.m.p.ma.psp" value ="0"/>
 <Value name="cc" source ="c.java" package ="es.m.p.ma.tr" value ="0"/>
 <Value name="dd" source ="d.java" package ="es.m.p.ma.tr" value ="0"/>
 </Values>
</Metric>

<Metric id = "TLOC" description ="Total Lines of Code" max ="-1">
 <Value value="5039"/>
</Metric>

<Metric id = "CA" description ="Afferent Coupling" max ="50">
 <Values per = "packageFragment" avg = "3,87" stddev = "7,165" max = "34">
   <Value name="es.m.p.bu.vo" package ="es.m.p.bu.vo" value ="34"/>
   <Value name="es.m.p.bu.ex" package ="es.m.p.bu.ex" value ="10"/>
   <Value name="es.m.p.bu.dao" package ="es.m.p.bu.dao" value ="0"/>
 </Values>
</Metric>
</Metrics>


Current Thread
Keywords