Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

XSL: count function

Featured Replies

Does anyone know how to use the count function within xsl?

I know have the following structure:

The xml should show something like:

But how?

Thanks in advance.

Kip

The xml should show something like:

The above is not xml. Just like HTML, attributes must be in this form:

or

some value

No spaces in element or attribute names. One space after an element name before an (optional) named attribute (or space-separated multiple attributes). You cannot have an attribute value (="6") with no attribute name.

is correct (or would be, but you forgot the quote), the rest is not.

You could have:

you're the best

the other 9 titles

the other 5 items

Or something similar:

ABCD

you're the best

the other 9 titles

the other 5 items

We don't know what xml exactly you are trying to produce; there's more than one way to do the above. But what you posted is not valid xml.

  • Author

Hi Fenton,

Thank you for your quick reply.

I now see that I wasnt clear enough.

In the xsl I want to use the count function that counts the number of childs of and all values of within .

I tried something like:

Kip,

this can not work.

You try to count on a node-set that you are generating in the very moment, i.e. on an output node-set.

The count() function is defined for input node-sets, i.e. existing node-sets only.

But anyway, if I understand correctly what you want to do, you don't need the count() function for your ITEMS. If it worked in your case, it would just be the number of records, wouldn't it?

This information is just in the FOUND attribute of your RESULTSET tag in the FMPXMLRESULT grammar.

So,

The number of titles, however, per item must be counted.

The final result would be, when we take the correct remarks of Fenton (you MUST produce well-formed and valid XML) into account:






  

    

      

      

      

        

          

            

          

        

      

    

  



Edited by Guest
code changed after remarking comments of Fenton

And a shorter form could be:






  

    

    

      

      

      

        

          

        

      

    

  



  • Author

Many, many Thanks! It is working fine now!

  • Newbies

Hi!!!

The following gives the count of the number of records in the resultset found

This should possibly solve your problem

Preeti

Hi!!!

The following gives the count of the number of records in the resultset found

This should possibly solve your problem

Preeti

This is true for the fmresultset grammar. However, he used the FMPXMLRESULT grammar. See my post above.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.