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

Re: building path expressions around dynamic element n

Subject: Re: building path expressions around dynamic element node names
From: omprakash.v@xxxxxxxxxxxxx
Date: Wed, 18 May 2005 17:10:01 +0530
dynamic element name
Hi,
           You can use the name() or the local-name() function to check if
the node name equals something. Thus if you want to check if the context
node is 'Dynamic1' you can use

<xsl:if test="name(.) = 'Dynamic1' ">

<!-- do some processing here -->

</xsl:if>


On first look, it appears that you have to make 2 passes, first to
aggregate the nodes you want and then to
select the nodes. This can be done using modes.

Cheers,
Omprakash.V





                                                                                                                     
                    Rahil                                                                                            
                    <qamar_rahil@ya        To:     XSL List <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>                        
                    hoo.co.uk>             cc:     (bcc: omprakash.v/Polaris)                                        
                                           Subject:      building path expressions around dynamic element node  
                    05/18/2005             names                                                                     
                    03:57 PM                                                                                         
                    Please respond                                                                                   
                    to xsl-list                                                                                      
                                                                                                                     
                                                                                                                     




Hi

I have an xml file with some dynamic element node names such as below:

<Top>
    <Dynamic1>
          <A>
                <Class id="123">Dynamic1</Class>
         </A>
          <B>
                <Class id="897">Not Present</Class>
          </B>
    </Dynamic1>
    <Dynamic2>
          <A>
                <Class id="567">Dynamic2</Class>
         </A>
          <B>
                <Class id="908">Car</Class>
          </B>
    </Dynamic2>
</Top>

I have  a for-loop that extracts all the node fragments where
B/Class[.='Not Present']. What I then want to do is access all the
dynamic element nodes such as '<Dynamic1>', '<Dynamic2>', etc. (which is
the same as the <Class> text() of the <A> node). How can I do this?

Also, (I know Ive read this somewhere but cant find it now) how can I
match an element name with some value i.e. how can I carry out an
operation such that Top/{next element name}='Dynamic1' ?

Thanks for all help.
Rahil






This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

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.