Check for default value of attribute in XPath

Posted by iref on Stack Overflow See other posts from Stack Overflow or by iref
Published on 2010-04-12T20:30:50Z Indexed on 2010/04/12 20:33 UTC
Read the original article Hit count: 321

Filed under:
|

Hi, i have 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 which have @visible=true,

//contacts[@visible='true']

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

<contacts />

so i want to know if there is any function in XPath which returns also default values of attributes

Thanks

Jan

© Stack Overflow or respective owner

Related posts about xpath

Related posts about Xml