[Home] [By Thread] [By Date] [Recent Entries]
At 07:46 AM 2/15/2006, cknell@xxxxxxxxxx wrote:
My intention was not to stop anyone from replying, but to have you clarify your requirement. My requirement is to find the indexterms that do not have ancestor elements of div* or table that that have a publicOnly setting of Yes. I think you missed the statement at the top that indicates my DTD provides a default value of No for the attribute publicOnly. So here is a very simplified view of the content: <doc>
<div1> <!-- publicOnly=No is the default -->
<div2> <!-- publicOnly= No is defaulted -->
<indexterm> <!-- I want to find this one -->
<indexterm> <!-- I want to find this one --><table> <!-- publicOnly=No is the default --> <tr><td> <indexterm> <!-- I want to find this one --> <table publicOnly='Yes'> <tr><td> <indexterm> <!-- I DON'T want to find this one --> This XPath returns all 4 hits: //indexterm[ancestor::*[(starts-with(local-name(),'div') or local-name()='table') and @publicOnly!='Yes']] I was trying to find other variations of this XPath to see if I could get the results I wanted, they didn't solve the problem. So I'm looking for the correct XPath to find what I have marked above. In reworking the example to add the defaults, it appears that this one actually solves the problem: //indexterm[ancestor::*[(starts-with(local-name(),'div') or local-name()='table')][1][ @publicOnly!='Yes']] In testing in the full document, it appeared as if the Default values were not being read from the DTD I had. I had left a previous test of setting publicOnly=yes on the div2 tag and was not getting the results I was expecting. In looking at the file this morning, I removed that and I'm getting whatI expect. Sometimes the best debugger is trying to explain the problem to someone else ;-) Let's parse your XPath expressions, I'll give my understanding of them.: These were variations on the one in the template that I had, I explained what they found. Anyway here is a new sample that provides the "defaulted values". In case anyone wants to play with this further. <doc> <div1><head>Chapter 1</head> <div2 membersOnly="Yes" statusCR="Yes" publicOnly='No'> <indexterm primaryDesc="Yes"><primary>AboveGroundIndicator type</primary><secondary>definition MEMBERS INDEX</secondary> </indexterm> <indexterm><primary>base types</primary><secondary>AboveGroundIndicator type MEMBERS INDEX</secondary> </indexterm> <head id="bAboveGroundIndicator"> <baseclass>AboveGroundIndicator</baseclass> </head> <p>Full name: Above Ground Indicator</p> <p class="CR">CR STATUS INFORMATION</p> <div-sub membersOnly="Yes" statusCR="Yes"> <head> Description</head> <p>Indicates whether the item is above ground.</p> </div-sub> <table border="1" id="oTable" membersOnly="Yes" statusCR="Yes" width="935" publicOnly='No'> <thead> <tr valign="top"> <th colspan="15" > Tag/Type </th> <th >Usage </th> <th > Description </th> </tr> </thead> <tbody> <tr membersOnly="Yes" statusCR="Yes" valign="top"> <td class="nest1"> <p> </p> </td> <td class="nest1" colspan="16"> <p> <baseclass ref="bAboveGroundIndicator">AboveGroundIndicator</baseclass> <indexterm><primary>AboveGroundIndicator type</primary><secondary>use of MEMBERS INDEX</secondary> </indexterm> (CR STATUS) <baseclass></baseclass>,
Usage: Required
</p>
</td>
</tr>
<tr membersOnly="Yes" statusCR="Yes" valign="top">
<td class="nest1">
<p> </p>
</td>
<td class="nest1" colspan="16">
<p>End of Type:
<baseclass ref="bAboveGroundIndicator">AboveGroundIndicator</baseclass>
</p>
</td>
</tr>
</tbody>
</table>
<indexterm><primary>AboveGroundIndicator type</primary><secondary>use of PUBLIC INDEX</secondary> </indexterm> (CR STATUS) Usage: Required </p> </td> </tr> <tr membersOnly="Yes" statusCR="Yes" valign="top"> <td class="nest1"> <p> </p> </td> <td class="nest1" colspan="16"> <p>End of Type: <baseclass ref="bAboveGroundIndicator">AboveGroundIndicator</baseclass> </p> </td> </tr> </tbody> </table> </div2> </div1> </doc> --------------------------------------------------------------------------- Danny Vint Specializing in Panoramic Images of California and the West http://www.dvint.com voice: 510-522-4703 When H.H. Bennett was asked why he preferred to be out shooting landscapes rather than spending time in his portrait studio: "It is easier to pose nature and less trouble to please." http://www.portalwisconsin.org/bennett_feature.cfm
|

Cart



