Quote:
Originally Posted by mhkay
number(@maxOccurs) > 1 means take the attribute node called maxOccurs, convert it to a number, and test to see if the number is greater than 1. The way number() works, if there is no such attribute or if it is not numeric, the value will be NaN, and NaN > 1 is false.
The expression I showed you will select the relevant element. Like any expression that returns a node-set, you can use it in a boolean context (for example in <xsl:if test="....">) and it will return true if the node-set is non-empty.
|
Hi Michael, thanks for your help. It works now. I had to do still a little extra because
select="ancestor-or-self::*[number(@maxOccurs) > 1 or @maxOccurs = 'unbounded' or parent::xs:complexType][1]"
selects the node that has either maxOccurs or a parent which is complexType, so need to check that again:
<xsl:variable
name="isMulti1"
select="ancestor-or-self::*[number(@maxOccurs) > 1 or @maxOccurs = 'unbounded' or parent::xs:complexType][1]"/>
<xsl:variable
name="isMulti"
select="boolean(number($isMulti1/@maxOccurs)>1 or $isMulti1/@maxOccurs='unbounded')"/>