473,698 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 = "Distinctiv e"
cars/make/shortmodels/shortmodel/longmodels/longmodel/derivatives/derviate[@vehicle_id='14 825420040501']
= "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='14 825420040501

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">Alf a Romeo<shortmode ls>
<shortmodel>147 <longmodels>
<longmodel>Dist inctive<derivat ives>
<derivative vehicle_id="148 25420040501">
<price>13936</price>
<co2>192</co2>
<fueltype>U</fueltype>1.6 T.Spark Distinctive
hatchback<colou rs/>
<trims/>
</derivative>
<derivative vehicle_id="148 25520040501">
<price>14667</price>
<co2>194</co2>
<fueltype>U</fueltype>1.6 T.Spark Distinctive
hatchback<colou rs/>
<trims/>
</derivative>
</derivatives>
</longmodel>
<longmodel>Ediz ione Exclusiva<deriv atives>
<derivative vehicle_id="697 43420040501">
<price>14323</price>
<co2>192</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Exclusiva
hatchback<colou rs/>
<trims/>
</derivative>
<derivative vehicle_id="697 43620040501">
<price>15054</price>
<co2>194</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Exclusiva
hatchback<colou rs/>
<trims/>
</derivative>
<derivative vehicle_id="697 44120040501">
<price>14658</price>
<co2>192</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Exclusiva
hatchback<colou rs/>
<trims/>
</derivative>
</derivatives>
</longmodel>
<longmodel>Ediz ione Sportiva<deriva tives>
<derivative vehicle_id="697 43320040501">
<price>12648</price>
<co2>192</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Sportiva
hatchback<colou rs/>
<trims/>
</derivative>
<derivative vehicle_id="697 43520040501">
<price>13348</price>
<co2>194</co2>
<fueltype>U</fueltype>1.6 T.Spark Edizione Sportiva
hatchback<colou rs/>
<trims/>
</derivative>
</derivatives>
</longmodel>
</longmodels>
</shortmodel>
<shortmodel>156 <longmodels>
<longmodel>Dist inctive<derivat ives>
<derivative vehicle_id="697 15520040501">
<price>17136</price>
<co2>195</co2>
<fueltype>U</fueltype>1.6 T.Spark 16V Distinctive
sedan<colours/>
<trims/>
</derivative>
<derivative vehicle_id="697 15620040501">
<price>17703</price>
<co2>202</co2>
<fueltype>U</fueltype>1.8 T.Spark 16V Distinctive
sedan<colours/>
<trims/>
</derivative>
</derivatives>
</longmodel>
<longmodel>Ediz ione Esclusiva<deriv atives>
<derivative vehicle_id="795 24520040501">
<price>16750</price>
<co2>195</co2>
<fueltype>U</fueltype>1.6 T.Spark 16V Edizione Esclusiva
sedan<colours/>
<trims/>
</derivative>
<derivative vehicle_id="795 10720040501">
<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 1246

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

Similar topics

2
1905
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" type="text"><span onClick="dosomething(???);" style="cursor:hand;">Do It!</span></span>
4
22203
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 description and a class_id (stored in the value attribute of each option). The user will then select a class from the drop-down list. What I want to do is have a control in the parent browser window which can store the class_id and the...
4
2639
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 an element, and I want to get the parent attribute that contains an actual value up the chain. This might be the immediate parent's attribute, the grandparent's attribute or the great grandparent's attribute (max of 3 levels).
0
1176
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 attribute value and would like to have details out of the xml file.
25
6200
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 rarely refer to a subform ir parent form's controls or records from the other form. Instead, I call a procedure in that form that does the job. That's all fine and good, and nothing at all revolutionary, but it leaves one with an annoying...
25
10244
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 data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
2
1247
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() strSql="insert into table1(column2) values('test1')" cmd = New OdbcCommand(strSql, con)
4
1467
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 doesnt recognize the checkbox element whose position was changed. How do i retrieve the value of the checkbox whose position was changed?
0
1122
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 ----------- ---------------------------------------- ---------- ------------ 1 SelectByPlan A 2 SPT A 3 SP A
0
8683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8876
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.