Given this XML segment - Note it is a representation of concept of the
data I am using.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<car>
<CarInfo vin = "4FL2002123 45">
<Owner>J. P. Morgan</Owner>
</CarInfo>
</car >
<car>
<CarInfo vin = "3CL2002123 45">
<Owner>J.P. Thompson</Owner>
</CarInfo>
</car >
<carSpecifics vin = "4FL2002123 45">
<CarMake xrefId = "XREF12345" >
<Color>Red</Color>
<Style>Sedan</Style>
</CarMake>
</carSpecifics>
<carSpecifics vin = "3CL2002123 45">
<CarMake xrefId = "XREF67890" >
<Color>Red</Color>
<Style>Sedan</Style>
</CarMake>
</carSpecifics>
<CarXref xrefId = "XREF12345" >
<Incident>Frida y Crash</Incident>
</CarXref>
<CarXref xrefId = "XREF67890" >
<Incident>Sat Crash</Incident>
</CarXref>
</root>
I need to walk all car nodes. With the goal of outputting only the
CarXref\Inciden t node.
Per each attribute VIN, I need to obtain the carSpecifics
\CarMake@xrefId . From that I need to output the CarXref\Inciden t node
associated with a xrefId. For example. CarInfo vin = "4FL2002123 45
matches to carSpecifics vin = "4FL2002123 45" which has an CarMake
xrefId = "XREF67890" which in turn has CarXref xrefId = "XREF12345"
with contents of CarXref\Inciden t Friday Crash. I want to output
this.
I know this sounds insane, but the XML file I have been given is in
this structure and I have to transform only parts of its contents.
I am beginning to believe that I have to use a regular XML parser as I
cannot determine how XSL would let me do this. I can get CarMake
xrefId yet I have to output text via the xsl-value of and I cannot get
to the final node.
data I am using.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<car>
<CarInfo vin = "4FL2002123 45">
<Owner>J. P. Morgan</Owner>
</CarInfo>
</car >
<car>
<CarInfo vin = "3CL2002123 45">
<Owner>J.P. Thompson</Owner>
</CarInfo>
</car >
<carSpecifics vin = "4FL2002123 45">
<CarMake xrefId = "XREF12345" >
<Color>Red</Color>
<Style>Sedan</Style>
</CarMake>
</carSpecifics>
<carSpecifics vin = "3CL2002123 45">
<CarMake xrefId = "XREF67890" >
<Color>Red</Color>
<Style>Sedan</Style>
</CarMake>
</carSpecifics>
<CarXref xrefId = "XREF12345" >
<Incident>Frida y Crash</Incident>
</CarXref>
<CarXref xrefId = "XREF67890" >
<Incident>Sat Crash</Incident>
</CarXref>
</root>
I need to walk all car nodes. With the goal of outputting only the
CarXref\Inciden t node.
Per each attribute VIN, I need to obtain the carSpecifics
\CarMake@xrefId . From that I need to output the CarXref\Inciden t node
associated with a xrefId. For example. CarInfo vin = "4FL2002123 45
matches to carSpecifics vin = "4FL2002123 45" which has an CarMake
xrefId = "XREF67890" which in turn has CarXref xrefId = "XREF12345"
with contents of CarXref\Inciden t Friday Crash. I want to output
this.
I know this sounds insane, but the XML file I have been given is in
this structure and I have to transform only parts of its contents.
I am beginning to believe that I have to use a regular XML parser as I
cannot determine how XSL would let me do this. I can get CarMake
xrefId yet I have to output text via the xsl-value of and I cannot get
to the final node.
Comment