Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

My question is 7.5 Note 1: Exercise 7.5 refers to exercise 7.2, which refers to

ID: 3681493 • Letter: M

Question

My question is 7.5

Note 1: Exercise 7.5 refers to exercise 7.2, which refers to 7.1. It is not necessary to create the formal schema document for exercise 7.1. The description of the XML schema structure in exercise 7.1 should be sufficient to create the XML document required for exercise 7.2. This XML document is a required submission for exercise 7.5. Exercise 7.5 also refers to the output of exercise 7.4. It is not necessary to create the formal XSLT stylesheet document for exercise 7.4. You may choose to perform this intermediate step before moving directly to the XSLT stylesheet for exercise 7.5 as done in the plane example in the text, but it is not required. The XSLT stylesheet described in exercise 7.5 is a required submission.

output should include an xsl doc

Explanation / Answer

xml schema

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<?xml-stylesheet type="text/css" href="car.css"?>

<cars>
<car-elements>
<engine>maruthi</engine>
<accessories>accessories</accessories>
</car-elements>
  
<car>
    <make>2001 </make>
    <model> 2002</model>
    <color>red </color>
    <year>2002 </year>
    <engine>marthi</engine>
    <no_of_doors>4</no_of_doors>
<Transmission_type>flat</Transmission_type>
<accessories>audio system </accessories>
</car>

<engine>
    <no_of_cylinders>4 </no_of_cylinders>
   <fuel_system>petrol</fuel_system>
</engine>


<accessories>
<radio>yes</radio>

<air_conditioning>yes</air_conditioning>

<power_windows>yes</power_windows>

<power_steering>yes</power_steering>
<power_breakes>yes</power_breakes>
</accessories>

</cars>

----------------------------------------

car.css

car
{
background-color:#ffffff;
width:100%;
}
engine
{
display:block;
margin-bottom:30pt;
margin-left:0;
}

accessories
{
color:#0000ff;
font-size:20pt;
}

car.xsl
--------
XSLT stylesheet for the above program
<?xml version="1.0" encoding="ISO-8859-1?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999xsl/transform" xmlns="http://www.w3.org/1999/xhtml">
<body>
<xsl:for-each select="cars/car">
<div>
<span><xsl:value-of select="make"></span>
<xsl:value-of select="color"/>
</div>
<div>
<xsl:value-of select="year"/>
<span>
<xsl:value-of select="engine"/>
</span>
</div>
</xsl:for-each>
</body>
</html>

XSLT
----------

<?xml version="1.0" encoding="ISO-8859-1"?>

<?xml-stylesheet type="text/xsl" href="car.xsl"?>

<cars>
<car-elements>
<engine>maruthi</engine>
<accessories>accessories</accessories>
</car-elements>
  
<car>
    <make>2001 </make>
    <model> 2002</model>
    <color>red </color>
    <year>2002 </year>
    <engine>marthi</engine>
    <no_of_doors>4</no_of_doors>
<Transmission_type>flat</Transmission_type>
<accessories>audio system </accessories>
</car>

<engine>
    <no_of_cylinders>4 </no_of_cylinders>
   <fuel_system>petrol</fuel_system>
</engine>


<accessories>
<radio>yes</radio>

<air_conditioning>yes</air_conditioning>

<power_windows>yes</power_windows>

<power_steering>yes</power_steering>
<power_breakes>yes</power_breakes>
</accessories>

</cars>