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

Re: Can this all fit into one Xpath expression?

Subject: Re: Can this all fit into one Xpath expression?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 14 Apr 2009 15:07:31 -0400
Re:  Can this all fit into one Xpath expression?
At 2009-04-14 14:02 -0500, russurquhart1@xxxxxxxxxxx wrote:
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.

In XPath 2.0 you can use sequence notation and have:


//GenTable/table/tgroup/tbody/row/entry[Emphasis[ . = ( 'Address Offset',
                                                        'Physical Address',
                                                        'Instance',
                                                        'Description',
                                                        'Type' ) ]
                                                [@type='bold']
                                       ]

That would select the entry element that has the emphasis you seek ... then in XSLT or XQuery you construct the end result by constructing the element and attribute nodes you need. It doesn't handle nested emphasis, only emphasis that is a direct child of the entry. If you need to identify an entry with emphasis anywhere inside of it you need to modify the above to read:

... entry[.//Emphasis[ ....

I'm not sure to what you are referring when you say "I want to set ...." ... are you using XPath in, perhaps, a DOM implementation?

I hope this helps.

. . . . . . . . . Ken

--
XSLT/XSL-FO/XQuery training in Los Angeles (New dates!) 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.