No, there is no way to say "give me the parent where it would go if you
don't find it".

Perhaps you just want to search for name elements without the attribute?
For example:

   /person/name[count(@serialid) = 0]
or

   /person/name[not(@serialid)]

would work.

Dave



                                                                                       
                            
                    "Zubair                                                            
                            
                    Mohammed"             To:     [EMAIL PROTECTED]             
                            
                    <mohdzubair@ho        cc:     (bcc: David N Bertoni/CAM/Lotus)     
                            
                    tmail.com>            Subject:     Provision in Xpath to get a 
handle to the parent???         
                                                                                       
                            
                    06/26/2001                                                         
                            
                    02:25 PM                                                           
                            
                    Please respond                                                     
                            
                    to xalan-dev                                                       
                            
                                                                                       
                            
                                                                                       
                            




Hi,
In my application i may need to add/insert attributes in a xml_tree.
Eg: If the doc looks like

  <person>
    <name>Dave</name>
    <age>20</age>
    <Sex>Male</Sex>
  </person>

  But would like to add an attribute: serialid

  <person>
    <name serialid="02">Dave</name>
    <age>20</age>
    <Sex>Male</Sex>
  </person>


I therefore use the xpath with /person/name/@serialid to traverse the tree.

But when i use
xObj = contextXPath->execute(......)
i get a null, which is true because this attribute does not exist as of
now.

But is there any way i could get a reference to the node <name> so that i
can use setAttribute and set this new attribute.

Any help would be appreciated.

regards,
Mohammed Zubair.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





Reply via email to