tags:

views:

48

answers:

1

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

A: 

You need a schema-aware processor like Saxon-EE.

lexicore
Thanks for answer. I need it as match pattern for XSL transformation so Saxon-EE is not solution, but it s good to know :)I hacked it like this //contacts[@visible='true' or not(@visible)]Althought I don' t like this solution very much.
iref