Check the default attribute value in XPath

I have an XML Schema:

<xsd:complexType name="contactsType">
  <xsd:sequence>
    <xsd:element name="contact" type="contactType" minOccurs="0" maxOccurs="unbounded"/>
  </xsd:sequence>
  <xsd:attribute name="visible" type="xsd:boolean" default="true"/>
</xsd:complexType>

      

and I want to find all contacts that have @visible = true,

//contacts[@visible='true']

      

but this expression doesn't return nodes without @visible setting like this:

<contacts />

      

so I want to know if there is any function in XPath that returns default values ​​of attributes as well

thanks

Jan

+2


source to share


1 answer


You need a schema -capable processor such as Saxon-EE .



0


source







All Articles