Skip to content Skip to sidebar Skip to footer

Calculating Element Max Attribute Value Fails Using Xslt And Xpath

I am coding a ui.xsl to translate ui.xml into ui.html. The ui.xml is:

Your test does not do what you think it does:

@row >= preceding-sibling::item/@row

will return true for any@row that is greater than or equal to at least one of its preceding siblings. That means it will be true for many values, not only the largest one/s.

And since you're obviously using an XSLT 1.0 processor, despite your stylesheet being tagged with version="2.0", you will get the first value that meets this condition, i.e. the value from the 2nd item.

The fact that you are getting the expected result for the @row is pure coincidence.

Solution 2:

Can't you do it simply like this :

<xsl:variable name="maxRow"select="max(ui/layout/item/@row)"/>

<xsl:variable name="maxCol"select="max(ui/layout/item/@column)"/>

Post a Comment for "Calculating Element Max Attribute Value Fails Using Xslt And Xpath"