• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 573
  • Last Modified:

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.
0
Richard Quadling
Asked:
Richard Quadling
  • 2
1 Solution
 
Richard QuadlingSenior Software DeveloperAuthor Commented:
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')])" />


0
 
Richard QuadlingSenior Software DeveloperAuthor Commented:
Better yet.

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

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now