Link to home
Start Free TrialLog in
Avatar of Richard Quadling
Richard QuadlingFlag for United Kingdom of Great Britain and Northern Ireland

asked on

XPath / XQuery issue with selecting nodes NOT containing a value.

Trying to xinclude content.

This is the data (it is a list of properties to a class) ...

    <classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>protected</modifier>
     <type>string</type>
     <varname linkend="exception.props.message">message</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>private</modifier>
     <type>string</type>
     <varname linkend="exception.props.string">string</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>protected</modifier>
     <type>int</type>
     <varname linkend="exception.props.code">code</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>protected</modifier>
     <type>string</type>
     <varname linkend="exception.props.file">file</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>protected</modifier>
     <type>int</type>
     <varname linkend="exception.props.line">line</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>private</modifier>
     <type>array</type>
     <varname linkend="exception.props.trace">trace</varname>
    </fieldsynopsis>


I now want to document a sub-class. In the sub-class private properties are not to be shown.

To include all the properties, the following tag works just fine.

<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/descendant::db:fieldsynopsis" />


What I want to do is exclude nodes which have a <modifier>private</modifier> sub-node.

I thought the following would work, but it doesn't.

<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/descendant::db:fieldsynopsis[modifier!=private]" />


I also need to extend the same logic to ...

<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis)" />


In both cases, I'm getting the private properties/methods and I want to exclude them.


Any ideas?

Regards,

Richard.
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Finally got this working.

<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/descendant::db:fieldsynopsis[(db:modifier/text()='protected') or (db:modifier/text()='public')])" />


ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial