Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8475045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:47:21+00:00 2026-06-10T17:47:21+00:00

I have several XML elements like this: <testcase starttime=2012-09-03 10:41:29 timestamp= 622.922000> <testlogfile file=

  • 0

I have several XML elements like this:

  <testcase starttime="2012-09-03 10:41:29" timestamp=" 622.922000">
    <testlogfile file="" />
    <teststep timestamp=" 622.944000" level="0" type="user" ident="1" result="pass">Do something</teststep>
    <teststep timestamp=" 622.965000" level="0" type="user" ident="2" result="pass">Do something</teststep>
    <teststep timestamp=" 622.986000" level="0" type="user" ident="3" result="pass">Do something</teststep>
    <verdict time="2012-09-03 10:41:30" timestamp=" 623.428000" endtime="2012-09-03 10:41:30" endtimestamp=" 623.428000" result="pass" />
    <title>Title goes here</title>
    <ident>TC100_06</ident>
    <description>description goes here</description>
    <extendedinfo type="test case status">Approved</extendedinfo>
    <extendedinfo type="traceability">some requirement</extendedinfo>
    <extendedinfo type="vehicle mode">Hibernate, Parked, Living, Accessory</extendedinfo>
    <extendedinfo type="environment">Station with ATB</extendedinfo>
    <extendedinfo type="variants">veh variants</extendedinfo>
  </testcase>

I would like to make a xsl:variable select query to count testcases by “ident” and “test case status”. I am able to implement 2 separate queries, but I dont know how to join them both:

<xsl:variable name="totalTc" select="count(//testcase[./ident!='text' and ./ident!='obsolete' and ./ident!='rtm' and ./ident!='status overview' and ./ident!='statistics'])"/>
<xsl:variable name="approvedTc" select="count(//extendedinfo[@type='test case status' and text()='Approved'])"/>

I expect joined query should look something like this, but I am unable to query attribute:

<xsl:variable name="totalTc" select="count(//testcase[./ident!='text' and ./ident!='obsolete' and ./ident!='rtm' and ./ident!='status overview' and ./ident!='statistics' and ./extendedinfo=='Approved'])"/>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:47:23+00:00Added an answer on June 10, 2026 at 5:47 pm

    How about…

    <xsl:variable name="totalTc" select="count(
      //testcase[
         ident!='text' and
         ident!='obsolete' and
         ident!='rtm' and
         ident!='status overview' and
         ident!='statistics' and
         extendedinfo[
             @type='test case status' and
             .='Approved']
       ])"/>
    

    Options

    Note in XSLT 2.0, you could instead use:

    <xsl:variable name="totalTc" select="count(
      //testcase[
         not (ident in ('text','obsolete','rtm','status overview','statistics')) and
         extendedinfo[@type='test case status' and .='Approved']
       ])"/>
    

    Also, instead of an expression of the form …

    testcase[ A and B]
    

    … one could instead write….

    testcase[A][B]
    

    The former case may be ever so slightly more efficient, but I think personal style should also factor in, in relation to your choice of expression. So for example, one could also put…

    <xsl:variable name="totalTc" select="count(//testcase
       [not (ident in ('text','obsolete','rtm','status overview','statistics'))]
       [extendedinfo[@type='test case status'][.='Approved']])"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several xml files that are formated this way: <ROOT> <OBJECT> <identity> <id>123</id>
I'm trying to have a script automatically transform an xml file into several html
I have an XML document that has several <item> elements. Inside each, there might
I have several XDocuments that look like: <Test> <element location=.\jnk.txt status=(modified)/> <element location=.\jnk.xml status=(overload)/>
I have an XML file that contains several subTrees and those subtrees can also
I have several xml files with different node structure. I want to extract xml
I have several existing XML schema files with a defined data model. I would
I have an XML document composed of several other XML documents appended to it.
I have an XML document, several actually, that will be editable via a front-end
I have several HTML elements (buttons) that fire the same JQuery AJAX request. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.