Retreiving Parent Values by specifying a attribute value

Discussion in 'XML' started by pathisunil@gmail.com, May 10, 2005.

  1. Guest

    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.
     
    , May 10, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Siffer
    Replies:
    3
    Views:
    5,796
    Karl Seguin
    Mar 30, 2005
  2. SandpointGuy

    Datalist retreiving values programatically

    SandpointGuy, May 27, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    322
    Eliyahu Goldin
    May 28, 2008
  3. Saifee

    retreiving checkbox list values

    Saifee, Dec 8, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    122
    Coucou à toutes et à tous
    Jan 6, 2004
  4. Noozer

    Retreiving values from

    Noozer, Apr 6, 2006, in forum: Javascript
    Replies:
    0
    Views:
    83
    Noozer
    Apr 6, 2006
  5. Angel
    Replies:
    4
    Views:
    119
    Angel
    Jul 17, 2006
Loading...

Share This Page