Count matching packages

P

Petterson Mikael

How can I count all java packages that contains fpx in their name using
xslt?

cheers,

//mikael

I have the following data:

<report>
<stats>
<packages value="44"/>
<classes value="1371"/>
<methods value="8293"/>
<srcfiles value="1356"/>
<srclines value="59524"/>
</stats>
<data>
<all name="all classes">
<coverage type="class, %" value="65% (892/1371)"/>
<coverage type="method, %" value="58% (4789/8293)"/>
<coverage type="block, %" value="53% (146231/274917)"/>
<coverage type="line, %" value="52% (31092.2/59524)"/>

<package name="se.company.product.subsys.boam.fpx.testsignals">
<coverage type="class, %" value="0% (0/2)"/>
<coverage type="method, %" value="0% (0/9)"/>
<coverage type="block, %" value="0% (0/61)"/>
<coverage type="line, %" value="0% (0/27)"/>
</package>
<package
name="se.company.product.subsys.boam.mao.dmo.auxdevice.tb.mock">
<coverage type="class, %" value="0% (0/1)"/>
<coverage type="method, %" value="0% (0/10)"/>
<coverage type="block, %" value="0% (0/51)"/>
<coverage type="line, %" value="0% (0/16)"/>
</package>
......................
 
J

Joris Gillis

Tempore 12:47:01 said:
How can I count all java packages that contains fpx in their name using
xslt?

count(/report/data/all/package[contains(@name,'fpx')])
 
P

Petterson Mikael

Joris said:
Tempore 12:47:01, die Wednesday 31 August 2005 AD, hinc in foro
{comp.text.xml} scripsit Petterson Mikael
How can I count all java packages that contains fpx in their name using
xslt?


count(/report/data/all/package[contains(@name,'fpx')])

Thanks that worked fine!

Two more questions:

How can I get the value ( percentage e.g. 65%) of attribute value for
element coverage?

When shall I use [ ] ?

cheers,

//mikael

I have the following data:

<report>
<stats>
<packages value="44"/>
<classes value="1371"/>
<methods value="8293"/>
<srcfiles value="1356"/>
<srclines value="59524"/>
</stats>
<data>
<all name="all classes">
<coverage type="class, %" value="65% (892/1371)"/>
<coverage type="method, %" value="58% (4789/8293)"/>
<coverage type="block, %" value="53% (146231/274917)"/>
<coverage type="line, %" value="52% (31092.2/59524)"/>

<package name="se.company.product.subsys.boam.fpx.testsignals">
<coverage type="class, %" value="0% (0/2)"/>
<coverage type="method, %" value="0% (0/9)"/>
<coverage type="block, %" value="0% (0/61)"/>
<coverage type="line, %" value="0% (0/27)"/>
</package>
<package
name="se.company.product.subsys.boam.mao.dmo.auxdevice.tb.mock">
<coverage type="class, %" value="0% (0/1)"/>
<coverage type="method, %" value="0% (0/10)"/>
<coverage type="block, %" value="0% (0/51)"/>
<coverage type="line, %" value="0% (0/16)"/>
</package>
......................
 
P

Petterson Mikael

Petterson said:
Joris said:
Tempore 12:47:01, die Wednesday 31 August 2005 AD, hinc in foro
{comp.text.xml} scripsit Petterson Mikael
How can I count all java packages that contains fpx in their name using
xslt?



count(/report/data/all/package[contains(@name,'fpx')])

Thanks that worked fine!

Two more questions:

How can I get the value ( percentage e.g. 65%) of attribute value for
element coverage?

When shall I use [ ] ?

cheers,

//mikael

I have the following data:

<report>
<stats>
<packages value="44"/>
<classes value="1371"/>
<methods value="8293"/>
<srcfiles value="1356"/>
<srclines value="59524"/>
</stats>
<data>
<all name="all classes">
<coverage type="class, %" value="65% (892/1371)"/>
<coverage type="method, %" value="58% (4789/8293)"/>
<coverage type="block, %" value="53% (146231/274917)"/>
<coverage type="line, %" value="52% (31092.2/59524)"/>

<package name="se.company.product.subsys.boam.fpx.testsignals">
<coverage type="class, %" value="0% (0/2)"/>
<coverage type="method, %" value="0% (0/9)"/>
<coverage type="block, %" value="0% (0/61)"/>
<coverage type="line, %" value="0% (0/27)"/>
</package>
<package
name="se.company.product.subsys.boam.mao.dmo.auxdevice.tb.mock">
<coverage type="class, %" value="0% (0/1)"/>
<coverage type="method, %" value="0% (0/10)"/>
<coverage type="block, %" value="0% (0/51)"/>
<coverage type="line, %" value="0% (0/16)"/>
</package>
.....................


I have tried the following Xpath expression:

/report/data/all/package/coverage[@type='block, %']/@value

Then I get "all" values for attribute value.
I need to get one/two/three digits e g. 5% or 24% or 100%. Is it
possible to do this?

cheers,

//mikael
 
P

Petterson Mikael

Petterson said:
Petterson said:
Joris said:
Tempore 12:47:01, die Wednesday 31 August 2005 AD, hinc in foro
{comp.text.xml} scripsit Petterson Mikael
<[email protected]>:

How can I count all java packages that contains fpx in their name using
xslt?




count(/report/data/all/package[contains(@name,'fpx')])

Thanks that worked fine!

Two more questions:

How can I get the value ( percentage e.g. 65%) of attribute value for
element coverage?

When shall I use [ ] ?

cheers,

//mikael

I have the following data:

<report>
<stats>
<packages value="44"/>
<classes value="1371"/>
<methods value="8293"/>
<srcfiles value="1356"/>
<srclines value="59524"/>
</stats>
<data>
<all name="all classes">
<coverage type="class, %" value="65% (892/1371)"/>
<coverage type="method, %" value="58% (4789/8293)"/>
<coverage type="block, %" value="53% (146231/274917)"/>
<coverage type="line, %" value="52% (31092.2/59524)"/>

<package name="se.company.product.subsys.boam.fpx.testsignals">
<coverage type="class, %" value="0% (0/2)"/>
<coverage type="method, %" value="0% (0/9)"/>
<coverage type="block, %" value="0% (0/61)"/>
<coverage type="line, %" value="0% (0/27)"/>
</package>
<package
name="se.company.product.subsys.boam.mao.dmo.auxdevice.tb.mock">
<coverage type="class, %" value="0% (0/1)"/>
<coverage type="method, %" value="0% (0/10)"/>
<coverage type="block, %" value="0% (0/51)"/>
<coverage type="line, %" value="0% (0/16)"/>
</package>
.....................



I have tried the following Xpath expression:

/report/data/all/package/coverage[@type='block, %']/@value

Then I get "all" values for attribute value.
I need to get one/two/three digits e g. 5% or 24% or 100%. Is it
possible to do this?

cheers,

//mikael

Hi,

I thought of using:

substring-before(@value,'%') but don't know how to add it to the xpath
expression.

All help is appreciated!

cheers,

//mikael
 
J

Joris Gillis

substring-before(@value,'%') but don't know how to add it to the xpath
expression.

substring-before(/report/data/all/package/coverage[@type='block, %']/@value,'%') ?
 
P

Petterson Mikael

Joris said:
substring-before(@value,'%') but don't know how to add it to the xpath
expression.


substring-before(/report/data/all/package/coverage[@type='block,
%']/@value,'%') ?

Hmmm....

I can't get this to work. My Xpath explorer is returning 0.
Any idea why?

//mikael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top