xsl-list
[Top] [All Lists]

how to differentiate between same nodes with diferent structure

2005-07-22 02:35:07
Hi!

In the same XML I have nodes of two different kinds:

1) The structure is Metric/Values/Value

<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>

2) The structure is Metric/Value
<Metric id = "TLOC" description ="Total Lines of Code" max ="-1">
 <Value value="5039"/>
</Metric>

And I want to do different things with them (in case one I want to show a
list, and in case two only the value).
I try to use a 
      <xsl:choose>
        <xsl:when test="">show my list</xsl:when>
        <xsl:otherwise>show de value</xsl:otherwise>
      </xsl:choose>

Statement, but I don't know how can I test if my node is of kind one or two.
I've read that you can test if a group of nodes is empty, but I don't know
how.
Consider that I'm using the namespace m to accede to the nodes

<xsl:stylesheet version="1.0"   
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:m="http://metrics.sourceforge.net/2003/Metrics-First-Flat";>
  

Thanks a lot!
Ana


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>