0% found this document useful (0 votes)
18 views7 pages

Final Assessment

Uploaded by

kngb145
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views7 pages

Final Assessment

Uploaded by

kngb145
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Final Assessment

1. Use the xsl:import function in the main stylesheet (main.xslt) to include the
templates from helper.xslt.
2. Write an XSLT to extract and transform data from a complex XML structure
using advanced XPath expressions.
3. Write a GatewayScript that reads the request chunk body using
readAsBuffers(), transforms the payload by adding a timestamp to each
chunk, and then forwards the modified payload to the backend service.
4. Write an XSLT file to process an XML document using both apply-templates
and call-template. The task is to demonstrate how these approaches can be
used to transform hierarchical XML data into a simplified structure.
5. Take the parameters from headers and do the query params backend
calling along with any oAuth security for the API.
Input1:
<library>
<book>
<title>Book A</title>
<author>Author 1</author>
</book>
<book>
<title>Book B</title>
<author>Author 2</author>
</book>
</library>

Expected output will be:


<library>
<book>
<title>Book A</title>
<author>Written by: Author 1</author>
</book>
<book>
<title>Book B</title>
<author>Written by: Author 2</author>
</book>
</library>
Request2:
<orders>
<order id="1001" status="shipped">
<customer>
<name>John Doe</name>
<email>[email protected]</email>
<address>
<street>123 Elm Street</street>
<city>Springfield</city>
<state>IL</state>
<zipcode>62701</zipcode>
</address>
</customer>
<items>
<item>
<name>Laptop</name>
<category>Electronics</category>
<quantity>1</quantity>
<price currency="USD">1200.00</price>
</item>
<item>
<name>Mouse</name>
<category>Accessories</category>
<quantity>2</quantity>
<price currency="USD">25.00</price>
</item>
</items>
<total>1250.00</total>
</order>
<order id="1002" status="processing">
<customer>
<name>Jane Smith</name>
<email>[email protected]</email>
<address>
<street>456 Oak Avenue</street>
<city>Metropolis</city>
<state>NY</state>
<zipcode>10001</zipcode>
</address>
</customer>
<items>
<item>
<name>Smartphone</name>
<category>Electronics</category>
<quantity>1</quantity>
<price currency="USD">800.00</price>
</item>
</items>
<total>800.00</total>
</order>
</orders>

Response2:
<shippedOrders>
<order id="1001">
<customer>
<name>John Doe</name>
<email>[email protected]</email>
<address>123 Elm Street, Springfield, IL, 62701</address>
</customer>
<items>
<item>
<name>Laptop</name>
<quantity>1</quantity>
<price currency="USD">1200.00</price>
</item>
<item>
<name>Mouse</name>
<quantity>2</quantity>
<price currency="USD">25.00</price>
</item>
</items>
<totalAmount>1250.00</totalAmount>
<totalItems>3</totalItems>
</order>
</shippedOrders>
Request3:
[
{"id": "1001", "item": "Laptop", "quantity": 1, "price": 1200},
{"id": "1002", "item": "Mouse", "quantity": 2, "price": 25},
{"id": "1003", "item": "Keyboard", "quantity": 1, "price": 50}
]
Response3:
[
{"id": "1001", "item": "Laptop", "quantity": 1, "price": 1200, "timestamp": "2024-
12-17T12:34:56.789Z"},
{"id": "1002", "item": "Mouse", "quantity": 2, "price": 25, "timestamp": "2024-
12-17T12:34:56.789Z"},
{"id": "1003", "item": "Keyboard", "quantity": 1, "price": 50, "timestamp": "2024-
12-17T12:34:56.789Z"}
]

Request4:
<company>
<department name="Engineering">
<employee id="E001">
<name>John Doe</name>
<role>Software Engineer</role>
<salary>80000</salary>
</employee>
<employee id="E002">
<name>Jane Smith</name>
<role>DevOps Engineer</role>
<salary>85000</salary>
</employee>
</department>
<department name="Marketing">
<employee id="M001">
<name>Emily Brown</name>
<role>Marketing Manager</role>
<salary>90000</salary>
</employee>
<employee id="M002">
<name>Michael Green</name>
<role>Content Specialist</role>
<salary>60000</salary>
</employee>
</department>
</company>

Output4:
<companySummary>
<department name="Engineering">
<employeeDetails>John Doe (Software Engineer)</employeeDetails>
<employeeDetails>Jane Smith (DevOps Engineer)</employeeDetails>
</department>
<department name="Marketing">
<employeeDetails>Emily Brown (Marketing Manager)</employeeDetails>
<employeeDetails>Michael Green (Content Specialist)</employeeDetails>
</department>
</companySummary>

You might also like