Hi guys,
I'm have some difficulties with my infopath form. I want to produce an XML file with the output based on a well defined XSD.
Basically the issue is that I have a structure like this:
<xs:element name="Profiles">
<xs:complexType>
<xs:sequence>
<xs:element ref="Profile" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Profile">
<xs:complexType>
<xs:sequence>
<xs:element ref="Nodes" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Nodes">
<xs:complexType>
<xs:sequence>
<xs:element ref="Node" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Node">
<xs:complexType>
<xs:attribute name="basePort" use="required" type="xs:string"/>
<xs:attribute name="hostName" use="required" type="xs:string"/>
<xs:attribute name="name" use="prohibited" type="xs:string"/>
</xs:complexType>
</xs:element>
A Profile should be able to have multiple Node elements, but the hostName attribute for each should be unique. I've added the following Data Validation rule to the hostName field in my form, but its seems to evaluate that I have multiple entries for hostName, not whether they are the same value:
count(/Profiles/Profile/Nodes/Node[@hostName = /descendant-or-self::node()/@hostName]) > 1
Has anyone got any ideas of how I can prevent the hostNames for a Profile from being duplicated ?
regards,
Trevor