Xsl count the elements with value x

Hello,
I'm trying to set up a transformation command in a stylesheet to get the number of nodes in a xml file that have a certain value. For the following xml source
<root>
<a>OK</a>
<a>FAIL</a>
<a>OK</a>
</root>
I would like to create html output like this
ok=2
fail=1
I've searched the xpath reference but the best match to get this done was the count() function that doesn't seem to be able to select on value level.
Can anyone help ?
Thanks.

count(//*[text()='OK'])
or something like that (with the predicate) is what you are looking for.

Similar Messages

  • How to count the elements with values in a Source?

    I have 2 measures which needs the same dimensions as inputs. So i use "Source.join()" to fill the inputs of both the measures like this:
    Source result = m1.join(m2).join(d1).join(d2);
    m1, m2: the "Source"s of the "MdmMeasure"s
    d1, d2: the "Source"s of the "MdmPrimaryDimension"s
    So before retrieving the results, i want to know how many lines i'm gonna have:
    Source resultCount = result.count();
    Here is my problem : the 2 measures have "NA"(1) but not the same "line" of data, and count returns the number of lines with data for the first measure (m1).
    I would like to have the number of lines which have data in at least 1 measure.
    example:
    | d1 | d2 | m1 | m2 |
    | a | b | 1 | 2 |
    | b | c | NA | 2 |
    | b | c | 4 | NA |
    | b | c | NA | NA |
    right now, i get 2, but i would like to get 3
    Can you help me please?
    NA(1) : when ValueCursor.hasCurrentValue() return false.
    Source(2) : http://oraclesvca2.oracle.com/docs/cd/B14117_01/olap.101/b10994/oracle/olapi/data/source/Source.html

    You have to put table name in Capital letters
    Like
    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = 'EMP';
    or
    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = UPPER('Emp');Regards
    Arun

  • How can I find the element with the closest value to a calculated "target value" in a 1D array?

    Hello all,
    may be the following question is very simple, but I am relatively new in labview and it would be great if somebody could help me:
    I have a acquaried 1D array of data-points. Now, I have to find the element in this array which value is the closest to a calculated "target value".
    After finding the element with the value close to the "target value", I have to get the position of this element (i.e. the index) in the 1D array.
    Now, I have to use this index to find and extract the element at this position in an other 1D array.
    It would be very nice if somebody could help me with this problem.
    Thank you,
    beam

    Find attached a sample vi that you can modify.
    Attachments:
    select_target_value.vi ‏22 KB

  • How to count the elements in a Source whith method count() ?

    hi all,
    I have a Source created by:
    Source s = m1.join(m2).join(m3).join(d1).join(d2);
    m1, m2, m3: MdmMeasure of the same Cube C1
    d1, d2: MdmPrimaryDimension of the same Cube C1
    I want to count the elements in this Source that have values so I used:
    s.count()
    I want to know the result of count() is the number of lines of m1 or m2 or m3?
    Whith the same source like this, can I count the elements of m2?? If it's possible, show me how to do it please!
    Always with the same source, is it possible to know which measure: m1 or m2 or m3 have the most elements not null?
    I can count the elements of each measure then compare its together but in my exercice, I have 20 measures so I find a method that avoid the most request and comparison!
    Thanks for your reply!

    hi all,
    I have a Source created by:
    Source s = m1.join(m2).join(m3).join(d1).join(d2);
    m1, m2, m3: MdmMeasure of the same Cube C1
    d1, d2: MdmPrimaryDimension of the same Cube C1
    I want to count the elements in this Source that have values so I used:
    s.count()
    I want to know the result of count() is the number of lines of m1 or m2 or m3?
    Whith the same source like this, can I count the elements of m2?? If it's possible, show me how to do it please!
    Always with the same source, is it possible to know which measure: m1 or m2 or m3 have the most elements not null?
    I can count the elements of each measure then compare its together but in my exercice, I have 20 measures so I find a method that avoid the most request and comparison!
    Thanks for your reply!

  • To count the elements in this Source

    hi all,
    I have a Source created by:
    Source s = m1.join(m2).join(m3).join(d1).join(d2);
    m1, m2, m3: MdmMeasure of the same Cube C1
    d1, d2: MdmPrimaryDimension of the same Cube C1
    I want to count the elements in this Source that have values so I used:
    s.count()
    I want to know the result of count() is the number of lines of m1 or m2 or m3?
    Whith the same source like this, can I count the elements of m2?? If it's possible, show me how to do it please!
    Always with the same source, is it possible to know which measure: m1 or m2 or m3 have the most elements not null?
    I can count the elements of each measure then compare its together but in my exercice, I have 20 measures so I find a method that avoid the most request and comparison!
    Thanks for your reply!

    Guys - Thanks for the quick response
    Bill - I think you are recommending the approach I had in the submitted code.
    David - the whole point is that I want to use the pipeline, not the Path argument, and I had no luck with your suggestion, which I took as:
            Get-ChildItem $from -Recurse  |
                Where-Object {(New-TimeSpan -Start  $_.LastWriteTime -End $cutoff).TotalHours -le 0} |
                ForEach-Object {Copy-Item -Path $_ -Destination {Join-Path $to $_.FullName.Substring($from.length)}; $fileCount++}
    However, all this did make me go read more documentation, and there is a -PassThru argument to Copy-Item which creates pipeline output after the copy.  Specifically:
            $fileCount=0
            Get-ChildItem $from -Recurse  |
                Where-Object {(New-TimeSpan -Start  $_.LastWriteTime -End $cutoff).TotalHours -le 0} |
                Copy-Item -Destination {Join-Path $to $_.FullName.Substring($from.length)} -PassThru |
                ForEach-Object {$fileCount++}
            Write-Host ("Copied {0} files/folders successfully at {1}" -f $fileCount, $(Get-Date))
    Thanks again
    JonW
    JonW

  • Count the number of values in a two dimensional array

    i am trying to figure out how to count the number of values in a two dimensional array.
    numScores = student[i][j].length;This doesn't work, i am trying to find a way of counting the columns

    Object[][] o;
    int tot = 0;
    for(int x = 0 ; x < o.length ; x++)
       tot += o[x].length;
    }If it's not a jagged array, however, this would be easier:
    int tot = o.length * o[0].length;

  • Count the number of values selected in a form

    Hello
    I need to count the number of values selected in a form.
    Here is my form dump:
    I want to count the values circled in red.
    So the number I want in this case is 5.
    Any suggestions?

    Aegis,
    Yeah, good point.  Here is a minor tweak:
    <cfset total = 0>
    <cfloop collection="#FORM#" item="field">
         <cfif field NOT IS "fieldnames">
           <cfset total += ListLen( FORM[ field ] )>
         </cfif>
    </cfloop>
    <cfoutput>
         <p>Total: #total#</p>
    </cfoutput>
    -Carl V.

  • How to remove the element with Iterators

    I have a programm like this
    Vector ts = new Vector();
    ts.add("abc"); ts.add("abd");
    Iterator it = ts.iterator();
    ts.remove("abc");
    it.remove();
    while(it.hasNext())
    { System.out.println("val = " + it.next()); }
    What is the problem if I use remove with iterator. It is giving the error java.lang.IllegalStateException. Can somebody tell me what is wrong with this.

    You can only use Iterator#remove() inside the Iterator loop (thus, after setting the cursor to the element using Iterator#next()).
    Also see the API doc: http://java.sun.com/javase/6/docs/api/java/util/Iterator.html
    What exactly do you want to do after all?

  • A report that shows all the elements with their setting

    Hi
    Is there a way to write a report in discoverer which will show all the elements set up in Oracle with there settings e.g. are they taxable or niable etc.
    Alternatively is there a standard report in HRMS which would give the same results.
    Thanks in advance

    Not really as such. Taxable and Niable elements feed to the appropriate taxable or niable balances therefore, you will need to run a report against what elements are fed into these balances. I doubt that there will be anything as standard in teh pre shipped EUL's that will enable you to do this, however, for simple one of why don't you just call up teh balances in teh application and see what elemenst feed into them.
    Cheers
    Scott

  • Count the all null values in the given table

    Suppose a table has n number of rows and columns .
    can any one tell the query to count the number of null values present in the table.
    For example :
    select * from tname:
    A      B
    cc    jhghf
    hff      -
    -       kjh
    tys     -
    -        gyrfg
    jjgg      -
    jfgh      -
    -        uytg
    10 rows selected..
    now to count the null vales in the table we can use --->   select count(1)-count(a)+count(2)-count(b) as ncount  from tname;
                                                                                      o/p:
                                                                                              ncount
                                                                                               11
    now my questions is we have n number of columns now pls tel tell me how to count the nulls present in table..?
    Thanks in Advance.

    Object[][] o;
    int tot = 0;
    for(int x = 0 ; x < o.length ; x++)
       tot += o[x].length;
    }If it's not a jagged array, however, this would be easier:
    int tot = o.length * o[0].length;

  • Count the number of values selected in a Dashboard prompt

    Hi,
    I have a requirement to show the count of the number of values selected in a Dashboard prompt. How to do that?
    Thanks in advance.

    Hi,
    Please follow below steps;
    1. create a report(which will show the number of value selected)-
    Pull the dimension column in criteria on which the prompt is created, make this column as IS PROMPTED. Edit the FX and put the expresion as; Count(*)2. In report pull narrative view add your custom text like "Number of prompt selected are @1". (@1 is nothing but he count of prompt selected.)
    3. Put this report on the dashboard which has prompt.
    Mark correct/helpful if it helps.
    Regards,
    Kashi
    Edited by: K N Yadav on 28 May, 2013 2:01 AM

  • How can I count the number of values in one column which answer to a condition in another column?

    I'm using Numbers 3.2 and would like to count the names in a column which satisfy a condition in a different column. There are 3 "streams" through which these names have come to me, and I would like to easily identify how many have come from each stream. Any help?

    Hi DirtyDawg,
    COUNTIF is your friend here.
    If your source is in column C and your streams are 1, 2 and 3:
    =COUNTIF(C,"=stream1")
    =COUNTIF(C,"=stream2")
    =COUNTIF(C,"=stream3")
    These need to be in a footer or header row or in a different column than C.
    hope this helps,
    quinn

  • Populating the table with values in a jsp

    need help...
    i have a jsp with 2 textboxes lastname and firstname and a button submit.
    wen i click on submit i should get a table on the same jsp below the submit button and it should be populated with the values entered in the textboxes.
    Can you pl help me out the the functionality of populating the textboxes?

    add a onclick function to button...on that onclick u hav e to populate a div with fname and lname
    in tat new div giv bean :write so tat u can get wat u have entered in above text boxes

  • WD4A with ALV, populating the header with values from the table

    I have WDA application that list schedule agreement headers in one ALV and when you select one the line items show in the second ALV2 below. We show quantity and net value  in 13 monthly buckets beginning with the validity data. The function returns the month text in columns I want to change the header based on the months returned. So instead of QNTY1, QNTY2 it would be 01/2008, 01/2008 etc. But ALV2 is initialized when the page is built and if I change the ALV2 settings after the line item function call they are not updated. On the page. Is there anyway I can do this???
    It tried put the code in the EXECUTE function method, and I tried WDMODIFYVIEW but the ALV is not refreshed.
    Thanks
    David

    Thanks for your help, I know I am probably doing something dumb but it is driving me crazy.
    I have debugged I can see the text change in the debugger but it doesn't show up on the screen. I removed the code from from the WDDOINIT. So am doing everything in the ONACTIONGETDETAIL to ensure that it is not being overwritten. I can change the 'number of lines', remove print button, change a field to an icon etc, but the column header doesn't change. If I put the same code in the WDDOINIT the column header does change. Everything else works in both places.
    *First ALV config
        l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
        IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
          l_ref_cmp_usage->create_component( ).
        ENDIF.
        DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.
        lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
        DATA lo_value TYPE REF TO cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model( ).
    *activate extended functions of the alv.
        cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
           r_model = lo_value ).
        lo_value->if_salv_wd_table_settings~set_visible_row_count( '10' ).
        lo_value->if_salv_wd_table_settings~set_selection_mode( '06' ).
        lo_value->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).
        DATA lr_column_settings TYPE REF TO if_salv_wd_column_settings.
        DATA lr_column TYPE REF TO cl_salv_wd_column.
        DATA lr_column_header TYPE REF TO cl_salv_wd_column_header.
        lr_column_settings ?= lo_value.
        lr_column = lr_column_settings->get_column( 'VBTYP' ).
        lr_column->delete_header( ).
        lr_column_header = lr_column->create_header( ).
        lr_column_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_none ).
        lr_column_header->set_text( '200708' ).
    *change column to icon
        lr_column = lo_value->if_salv_wd_column_settings~get_column( 'AUART_DESC' ).
        CREATE OBJECT lr_image.
        lr_image->set_source_fieldname( 'AUART_DESC' ).
        lr_column->set_cell_editor( lr_image ). "Display images in column
    Thanks again.
    David

  • I want to count the elements in the pipeline and also process them

    The following script works, but only because I save the pipeline contents in a variable.  I would like to not have to save it - see below. The commented section is my most recent failure. (And BTW I know the script has nothing to do with ZIP: that's
    the next step.
    function ZipUpModified {
        param ([string] $from, [string]$to, [datetime]$cutOff)
        try
            Write-Host ("Copying {0} modified on or after {1} to {2} in execution at {3}" -f $from, $cutOff.toString(), $to, $(Get-Date))
            if (-not (Test-Path -Path $from)) {Throw "Source folder $from does not exist"}
            if (Test-Path -Path $to) {Throw "Target folder $to already exists"}
    # I would like to substitute the next 5 lines for the following 4; but I cannot seem to get the pipeline to reach the Copy_Item
    #       $fileCount=0
    #        Get-ChildItem $from -Recurse  |
    #            Where-Object {(New-TimeSpan -Start  $_.LastWriteTime -End $cutoff).TotalHours -le 0} |
    #            ForEach-Object {Copy-Item -Destination {Join-Path $to $_.FullName.Substring($from.length)}; $fileCount++; }
    #        Write-Host ("Copied {0} files/folders successfully at {1}" -f $fileCount, $(Get-Date))
            $filelist=Get-ChildItem $from -Recurse  |
                Where-Object {(New-TimeSpan -Start  $_.LastWriteTime -End $cutoff).TotalHours -le 0}
            $filelist | Copy-Item -Destination {Join-Path $to $_.FullName.Substring($from.length)}
            Write-Host ("Copied {0} files/folders successfully at {1}" -f $filelist.count, $(Get-Date))
        catch
            Write-Host $($_.Exception.ToString() -replace ".*: ")
            Write-Host "so we are stopping..."
        finally
            $IgnoreThis = Read-Host "hit OK or Enter"
    ### Main
    $cutOff= (Read-Host 'Enter date of most recent backup (mm/dd/yyyy):') | Get-Date
    ZipUpModified "C:\Users\Jonathan\Desktop\Test_BU\SRC" "C:\Users\Jonathan\Desktop\Test_BU\TGT" $cutOff
    ## two more calls to ZipUpModified

    Guys - Thanks for the quick response
    Bill - I think you are recommending the approach I had in the submitted code.
    David - the whole point is that I want to use the pipeline, not the Path argument, and I had no luck with your suggestion, which I took as:
            Get-ChildItem $from -Recurse  |
                Where-Object {(New-TimeSpan -Start  $_.LastWriteTime -End $cutoff).TotalHours -le 0} |
                ForEach-Object {Copy-Item -Path $_ -Destination {Join-Path $to $_.FullName.Substring($from.length)}; $fileCount++}
    However, all this did make me go read more documentation, and there is a -PassThru argument to Copy-Item which creates pipeline output after the copy.  Specifically:
            $fileCount=0
            Get-ChildItem $from -Recurse  |
                Where-Object {(New-TimeSpan -Start  $_.LastWriteTime -End $cutoff).TotalHours -le 0} |
                Copy-Item -Destination {Join-Path $to $_.FullName.Substring($from.length)} -PassThru |
                ForEach-Object {$fileCount++}
            Write-Host ("Copied {0} files/folders successfully at {1}" -f $fileCount, $(Get-Date))
    Thanks again
    JonW
    JonW

Maybe you are looking for

  • ROS issue in SRM 7.0 with SAP EP

    Hi Gurus, I am on SRM 7.0 and have referred to several posts in this forum, in particular, these - Re: Not able to transfer suppliers from ROS to EBP Re: External Web Service setting for Supplier Registration ROS to EBP I have been able to bring the

  • Won't print to photo tray, but will print test page

    I have most current Vista driver, but can't print to photo tray.  It won't pull the tray in, although it works great when printing test page.  I tried various page/paper settings and "photo tray" light settings, but still won't print from Vista. Trie

  • Question about usage of aaa accounting commands

    Hi everyone, I have the problem that Cisco routers and switches do not send some accounting command information to ACS. Accounting commands do not send to ACS are "show log" and "show version". Accounting commands send to ACS are "show runn", "conf t

  • WHT tax not displaying in accounting document

    Hi I am trying to configure Withholding tax for AR process. I have attached the WHT tax type and code in the customer master. I try to create a debit note request, i do not get a popup which shows the WHT from the customer master for us to choose the

  • In the iTunes menu at the bottom left button to synchronize

    Hello, In the iTunes menu at the bottom left button to synchronize, there the information content from my Iphone audio, photos, applications, others and free. I wanted to know what is other (do this is the backup of my installed applications?) becaus