RyanSoper
RyanSoper

Reputation: 231

XSL Incrementing Variable

I understand that XSL is a functional language, and as such variables are immutable. However that poses and issue for me.

I have a script at the moment that reads through an XML file and produces a report on all the pages that don't have a tag. That all works fine, but I'd like to be able to return the number of XML nodes (apologies if I used the wrong terminology) that meet those conditions, any ideas how I could achieve that?

Upvotes: 0

Views: 73

Answers (1)

hr_117
hr_117

Reputation: 9627

If there is an xpath expression for the elements with your condition you can use:

<xsl:value-of select="count(XPATH-EXPRESSION)" />

If not you can have a recursive template call counting on the way down. And print the value at the end of the recursion.

Upvotes: 1

Related Questions