473,387 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Retreiving Parent Values by specifying a attribute value

Dear All

I have an xmldocument which is as formed below. It is a bit of loopy in
nature. can anyone kindly let me know how can i write a xslt which
would take a parameter which is an attribute value and would like to
have details out of the xml file.

I will the paste the xmldocument for your reference.The values required
as output are based on reverse pattern.The functionality requires this
pattern.The values required are as follows:

Required Output:Which happen to be as given below
cars/make = "alfa romeo"
cars/make/shortmodels/shortmodel = "147"
cars/make/shortmodels/shortmodel/longmodels/longmodel = "Distinctive"
cars/make/shortmodels/shortmodel/longmodels/longmodel/derivatives/derviate[@vehicle_id='14825420040501']
= "1.6 T.Spark Distinctive hatchback"

The above values which are in quotes must be returned after using an
xslt by giving the following attribute @vehicle_id='14825420040501

This particular xml file contains only 1 make, but in the original file
this make would be repeated in nature.

Example of the XML File.
<cars>
<make forsale="1">Alfa Romeo<shortmodels>
<shortmodel>147<longmodels>
<longmodel>Distinctive<derivatives>
<derivative vehicle_id="14825420040501">
<price>13936</price>
<co2>192</co2>
<fueltype>U</fueltype>1.6 T.Spark Distinctive
hatchback<colours/>
<trims/>
</derivative>
<derivative vehicle_id="14825520040501">
<price>14667</price>
<co2>194</co2>
<fueltype>U</fueltype>1.6 T.Spark Distinctive
hatchback<colours/>
<trims/>
</derivative>
</derivatives>
</longmodel>
<longmodel>Edizione Exclusiva<derivatives>
<derivative vehicle_id="69743420040501">
<price>14323</price>
<co2>192</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Exclusiva
hatchback<colours/>
<trims/>
</derivative>
<derivative vehicle_id="69743620040501">
<price>15054</price>
<co2>194</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Exclusiva
hatchback<colours/>
<trims/>
</derivative>
<derivative vehicle_id="69744120040501">
<price>14658</price>
<co2>192</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Exclusiva
hatchback<colours/>
<trims/>
</derivative>
</derivatives>
</longmodel>
<longmodel>Edizione Sportiva<derivatives>
<derivative vehicle_id="69743320040501">
<price>12648</price>
<co2>192</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Sportiva
hatchback<colours/>
<trims/>
</derivative>
<derivative vehicle_id="69743520040501">
<price>13348</price>
<co2>194</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Sportiva
hatchback<colours/>
<trims/>
</derivative>
</derivatives>
</longmodel>
</longmodels>
</shortmodel>
<shortmodel>156<longmodels>
<longmodel>Distinctive<derivatives>
<derivative vehicle_id="69715520040501">
<price>17136</price>
<co2>195</co2>
<fueltype>U</fueltype>1.6 T.Spark 16V Distinctive
sedan<colours/>
<trims/>
</derivative>
<derivative vehicle_id="69715620040501">
<price>17703</price>
<co2>202</co2>
<fueltype>U</fueltype>1.8 T.Spark 16V Distinctive
sedan<colours/>
<trims/>
</derivative>
</derivatives>
</longmodel>
<longmodel>Edizione Esclusiva<derivatives>
<derivative vehicle_id="79524520040501">
<price>16750</price>
<co2>195</co2>
<fueltype>U</fueltype>1.6 T.Spark 16V Edizione Esclusiva
sedan<colours/>
<trims/>
</derivative>
<derivative vehicle_id="79510720040501">
<price>17316</price>
<co2>202</co2>
<fueltype>U</fueltype>1.8 T.Spark 16V Edizione Esclusiva
sedan<colours/>
<trims/>
</derivative>
</derivatives>
</longmodel>
</longmodels>
</shortmodel>
</shortmodels>
</make>
</cars>
Thanks in advance...

Regards
Sunil.

Jul 20 '05 #1
0 1228

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mr_burns | last post by:
Hi, I am trying to pass a value of a <span> tag's id attribute to a function. The following code is a stripped down version of what im trying to do: <span id="6">Name: <input name="name"...
4
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a...
4
by: darrel | last post by:
Is there a way in XSLT to write this XSL:Value-of select statement (which I've written in plain english): value of the attribute of the first ascendent to have a value. In otherwords, I have...
0
by: pathisunil | last post by:
Dear All I have an xmldocument which is as formed below. It is a bit of loopy in nature. can anyone kindly let me know how can i write a xslt which would take a parameter which is an...
25
by: Steve Jorgensen | last post by:
Yup, Steve's full of tips, but hey, it makes him feel important, right? Ok, here goes. I've been trying to improve encapsulation by putting code in the same object as the stuff it affects, so I...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
2
by: Reddy | last post by:
Hi, Once after inserting a record into a table is there a more efficient way of retreiving the id(autonumber field) value in the following example. Using a SQL server database. con.Open() ...
4
by: Angel | last post by:
I have an html form with checkboxes in different rows. The functionality is that of changing the position of the checkboxes through DOM. When I try to save the form after the changes, firefox...
0
by: yogeeswar | last post by:
HI ALL I AM USING DB2 8.1 AND I HAVE TWO TABLES PARENT TABLE 1)CODE IS PRIMARY KEY CODE CODE_DESC CATEGORY ----------- ----------------------------------------...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.