xslt - Xpath or For-each to use to fetch particular node value based on condition -


i have following xml:

<endorsements>   <endorsement>     <vehiclenumber>1</vehiclenumber>       <vehicle>         <year>2014</year>         <make>honda</make>         <model>cab</model>       </vehicle>    </endorsement>                    <endorsement>                        <vehiclenumber>0</vehiclenumber>       <vehicle>         <year>2014</year>         <make>activa</make>         <model>suv</model>       </vehicle>     </endorsement>     <endorsement>       <vehiclenumber>0</vehiclenumber>       <vehicle>         <year>2014</year>                        <make>suzuki</make>         <model>sedan</model>       </vehicle>    </endorsement>  </endorsements> 

i need fetch value of year make "suzuki" , vehiclenumber 1. loop through <xsl:for-each> or use contains[text (),''] xpath?

i have tried xpath, it's not working. appreciated.

//endorsement[vehiclenumber=1]/vehicle[make="suzuki"]/year 

tested here: http://chris.photobooks.com/xml/default.htm

basic xpath reference: http://www.w3schools.com/xsl/xpath_syntax.asp


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -