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

Re: RE: Xpath question with processing-instruction()

Subject: Re: RE: Xpath question with processing-instruction()
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 20 Aug 2010 16:11:04 -0400
Re:  RE: Xpath question with processing-instruction()
Hi,

At 04:02 PM 8/20/2010, you wrote:
If I just copy that XML into Stylus Studio, and fire up the XPath editor, I can find the text node you're on, and apply the specified test:

//text()[. eq 'Text of a title'][../preceding-sibling::processing-instruction()/name() eq 'ModuleStart']

So it's the second test (i.e. the second bracketed expression) that you want. Substitute '=' for 'eq' if you're stuck with XPath 1.0.

Unfortunately the subexpression '../preceding-sibling::processing-instruction()/name()' won't work in XPath 1.0. And 'name(../preceding-sibling::processing-instruction())' will be unreliable in cases where there is more than one PI in that place (due to XPath 1.0 "first node semantics").


With the child of title (the text node) as context, try

../preceding-sibling::processing-instruction('ModuleStart')

to retrieve the PI.

To test that such a node does not exist,

not(../preceding-sibling::processing-instruction('ModuleStart'))

But wasn't this suggested?

Cheers,
Wendell

-----Original Message-----
From: Ylvisaker, Steve [mailto:steve.j.ylvisaker@xxxxxxxxxxxxx]
Sent: Thursday, August 19, 2010 1:44 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Xpath question with processing-instruction()

I know I can do this but I'm stumped.

Please consider the following XML:

<section>
<?ModuleStart ShowIDs="yes"?>
<title>Text of a title</title>
<para>para in the section</para>
</section>



I am current to the text() node of <title/>

I need to test to see if my parent has an immediate preceding sibling of processing-instruction named "ModuleStart"

If so I need to know the content of that PI.


I need to be sure that the test will NOT be true if I am current with the text() node of <para/>


Thanks in advance for your help
Steve


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

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.