[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: RE: Finding and processing index terms

Subject: RE: RE: Finding and processing index terms
From: Dan Vint <dvint@xxxxxxxxx>
Date: Wed, 15 Feb 2006 09:21:38 -0800
RE: RE:  Finding and processing index terms
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>&#xa0;</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>&#xa0;</p>
</td>
<td class="nest1" colspan="16">
<p>End of Type:
<baseclass ref="bAboveGroundIndicator">AboveGroundIndicator</baseclass>
 </p>
</td>
</tr>
</tbody>
</table>


<table border="1" id="oTable" publicOnly="Yes" statusCR="Yes" membersOnly="No" width="935"> <thead> <tr valign="top"> <th colspan="15" onclick="sorter(3,1)" style="cursor:hand;"> Tag/Type <p HelpOnly="Yes">Select to Sort</p> </th> <th onclick="sorter(2,1)" style="cursor:hand;">Usage <p HelpOnly="Yes">Select to Sort</p> </th> <th onclick="sorter(1,1)" style="cursor:hand;"> Description <p HelpOnly="Yes">Select to Sort</p> </th> </tr> </thead> <tbody> <tr membersOnly="Yes" statusCR="Yes" valign="top"> <td class="nest1"> <p>&#xa0;</p> </td> <td class="nest1" colspan="16"> <p> <baseclass ref="bAboveGroundIndicator">AboveGroundIndicator</baseclass>

<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>&#xa0;</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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.