Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

XSL: count function


This topic is 7000 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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.

Posted

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:

Posted (edited)

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
Posted

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.

This topic is 7000 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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