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

Home Posts Topics Members FAQ

Retreving Parent Values for a given 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/shortmod*el = "147"
cars/make/shortmodels/shortmod*el/longmodels/longmodel = "Distinctiv e"

cars/make/shortmodels/shortmod*el/longmodels/longmodel/deriva*tives/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.

Nov 12 '05 #1
0 1176

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

Similar topics

0
1247
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. 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:
10
11229
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#" onClick="window.open('/cgi-bin/displayimage.cgi?/store/demo/image.jpg&YOUR+PRODUCT%27<b>S+NAME+GOES', 'fullimage', 'WIDTH=420,HEIGHT=405,status=0')"> The original window should not reload, but is, and I have tested it with both version 4.72 and 7.02, and they both do it. IE does not do it....
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...
2
3956
by: Bill Cohagan | last post by:
In my app I'm validating an XML file against an XSD which contains several attribute default value specifications. I'm performing the validation via an xml document load() using a ValidatingXMLReader. After loading the document (and validating it) I assume that the resulting doc will (as appropriate) have elements with attributes set to their default values in those cases where there was nothing specified in the input XML file. However,...
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...
1
2065
by: GU | last post by:
How can one get a list of enumeration values for a given element in an XML schema? I have been looking at the Schema Object Model, but I'm making very little headway. Can anyone give me a nudge in the right direction? Specifically, I am using Actions Pane to assist in creating a WordML document. For elements with enumerated values, I want to provide the user with the list of valid values from the schema. For example, if I have an...
6
2545
by: Ray Schumacher | last post by:
What is the feeling on using "parent" in a class definition that class methods can refer to, vs. some other organization ? Should all relevant objects/vars just be passed into the method as needed? It seems like including "parent" in the class def is just like a class variable, which most do not recommend. An example: class LXSerial: def __init__(self, parent, debug=False): ...
4
2919
by: patrizio.trinchini | last post by:
Hi all, I'm new to XSLT and maybe my problem have a very trivial answer, but I need an expert that point me in the right direction. What I would obtain is to remove all the elements that have a child element with an attribute set at a given value; maybe an example is more self-explaining... Given the following input XML document:
1
3060
by: pbd22 | last post by:
Hi. Could some kind sould tell me what the javascript would be to get a given attribute of the parent "table" element of a given element inside that table. So, <table width="54">
0
8612
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
9032
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
8880
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
7743
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
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
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

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.