[xsl] Re: Can this all fit into one Xpath expression?

Subject: [xsl] Re: Can this all fit into one Xpath expression?
From: russurquhart1@xxxxxxxxxxx
Date: Wed, 15 Apr 2009 09:33:11 -0500 (CDT)
Since my post yesterday, i figured some things out, and i wanted to apologize for my ignorance on somethings.

I am interested in getting the GenTable elements that have Emphasis elements with the aforementioned properties.

I got partway there, on my own with the following:

//row/entry[Emphasis = 'Address Offset']/ancestor::row/following-sibling::row/entry[Emphasis = 'Physical Address']/following-sibling::entry[Emphasis = 'Instance']/ancestor::row/following-sibling::row/entry[Emphasis = 'Description']/ancestor::row/following-sibling::row/entry[Emphasis = 'Type']/ancestor::GenTable[1] 

This more closely matches the location of the elements as they are in the document, but this still doesn't check for @type='bold' or the condition that at least 4 of these conditions be true.

As i am using this Xpath, initially within Xmetal's javascript interpreter, i think they only support the Xpath 1.0 style. When i recast this as a standalone XSLT script, i will rewrite in an XPath 2.0 style.

All the help you've provided has been great, if this can still be put into one Xpath expression, i welcome the information and help!

Thanks again!


Russ

On Apr 14, 2009, russurquhart1@xxxxxxxxxxx wrote: 




Hi,

I have a structure with conditions something like this:

//GenTable/table/tgroup/tbody/row/entry[Emphasis = 'Address Offset'] and Emphasis[@type='bold']

//GenTable/table/tgroup/tbody/row/entry[Emphasis = 'Physical Address'] and Emphasis[@type='bold']

//GenTable/table/tgroup/tbody/row/entry[Emphasis = 'Instance'] and Emphasis[@type='bold']

//GenTable/table/tgroup/tbody/row/entry[Emphasis = 'Description'] and Emphasis[@type='bold']

//GenTable/table/tgroup/tbody/row/entry[Emphasis = 'Type'] and Emphasis[@type='bold']

If a GenTable element has four or the five entry elements, that match these conditions, i want to set GenTable[@role='Register'] and GenTable[@columns='1'].

Can this be squeezed into one hairy Xpath expression.

Sorry still trying to get my head around multiple predicates.

Any help is greatly appreciated!

Thanks,

Russ

Current Thread