-XML Application Development The example that will be used here will be the....

-XML Application Development

 

The example that will be used here will be the translating of measurements, both distance and weight, from one measurement standard to another. The distance measurements will translate from Imperial mile to Metric Kilometer. The weight measurements will translate from Troy Ounce to Metric Gram.

 

For this, you will produce 4 files:

 

· measurements1.html

 

· measurements1.xml

 

· measurements1.xsd

 

· measurements1.xslt

 

You will be creating the xml, xsd, and the xslt files using any text editor you want. The html file will be created for you using the saxon tool.

 

1. Use the measurements1.xsd file from the previous assignment.

 

2. Build an XML document based on the schema in measurements1.xsd. Name this document measurements1.xml.

 

a. This XML document should have a root of measurements.

b. This XML document should have at least 3 child elements to measurements.

 

3. Provide a XSLT style sheet to display the contents in the measurements1.xml file. Name this file measurements1.xslt.

 

a. The first template should match the root of the document.

i. Inside the template, provide a html document that outputs the total number of items in the measurements1.xml file and how many of each kind are in the file.

ii. There should also be an apply-templates call that matches the measurement element.

b. The second template should match measurement.

i. In this template, choose between weight and distance based on the attribute typeOfMeasurement

ii. For distanceType, you should output the distance/@measureDistance attribute, as well as the distance element.

iii. For weightType, you should output the [email protected] attribute, as well as the weight element.

 

4. Run these through the sax processor with the command 

Transform.exe -sa -s:measurements1.xml -xsl:measurements1.xslt -xsd:measurements1.xsd -o:measurements1.html

This should result in an html file that outputs something similar to:

 

The 3 measurements that I want transformed.

 

There are 2 distance measurements

 

There is 1 weight measurement.

 

A distance measurement using the imperial scale is:

 

The length of the distance is 1.45

A weight measurement using the troy scale is:

 

The amount of the weight is .6

A distance measurement using the metric scale is:

 

The length of distance is 25
Powered by