RE: RE: [xsl] Finding and processing index terms

Subject: RE: RE: [xsl] Finding and processing index terms
From: cknell@xxxxxxxxxx
Date: Wed, 15 Feb 2006 10:46:47 -0500
-----Original Message-----
From:     Dan Vint <dvint@xxxxxxxxx>

I'm replying to this just in case someone else reads it and stops their help. My template looks for indexterms, div* and table tags, these all appear in the sample stream. The stream and various XPaths were tested in Stylus studio, the only thing that is missing is the DTD to provide the defaults to the attributes.

My intention was not to stop anyone from replying, but to have you clarify your requirement.

Let's parse your XPath expressions, I'll give my understanding of them.:

//indexterm[ancestor::*[(starts-with(local-name(),'div') or local-name()='table') and @publicOnly!='Yes'][1]]

You're looking for an 'indexterm' element which has, at some point along it's ancestor axis, an element whose local name starts with 'div' or whose local name is 'table'. You want the proximate ancestor that matches. That ancestor element must have a 'publicOnly' attribute whose value is not 'Yes'

//indexterm[ancestor::*[(starts-with(local-name(),'div') or local-name()='table')][ @publicOnly!='Yes']]

In this case you have dispensed with the requirement that the element examined must be the proximate ancestor matching the criteria.

//indexterm[ancestor::*[(starts-with(local-name(),'div') or local-name()='table')][1][ @publicOnly!='Yes']]

This expression appears to be one that will have an identical evaluation to #1.

//indexterm[ancestor::*[(starts-with(local-name(),'div') or local-name()='table') and @publicOnly='No']]

Here you dispense with any proximity consideration and change the matching value of the 'publicOnly' attribute to 'No'.

//indexterm[ancestor::*[(starts-with(local-name(),'div') or local-name()='table') and not(@publicOnly)]]

This one is largely like the previous one except that you are restricting the ancestors to ones without a 'publicOnly' attribute.

None of these match anything in your sample data. Would you suggest that we change your XML so that one element will match one of the XPath expressions in order to proceed?

Charles Knell
cknell@xxxxxxxxxx - email

Current Thread