Please guys answer this following the instructions. THANKS.... 1) Write a comple
ID: 3598946 • Letter: P
Question
Please guys answer this following the instructions. THANKS....
1) Write a complete XML file named textbooks.xml, in which you describe at least a partial list of the textbooks you are using this semester. You should include at least two distinct textbooks. If you are using only one text this semester, expand your list to cover the current academic year.
Your description of each book must include the title, author(s), publisher, year of publication, and the ISBN. For each author, specify the first and last name as distinct values. Include both a name and website for the publisher. Optionally, try also to include any book-specific website (especially if it is distinct from the main publisher site, and if its URL is not ridiculously long). Finally, specify the edition and cover type (paperback or hardcover) of each book you are using. Make sure your final XML document is well-formed.
2) Write an XML Schema that can be used to validate textbooks.xml and name it textbook.xsd . Finally, remember to modify your new XML document so that it references your schema.
3. Develop an XSL Stylesheet for easy viewing of your textbook list and name it textbook.xsl
Explanation / Answer
1)
2)
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Manage the spinned words as you want..
An XML Schema describes the structure of an XML file.
The XML Schema language is also called XML Schema Definition .
The purpose of an XML Schema is to define the legal constructing blocks of an XML document:
the elements and attributes that can seem in a report
the quantity of (and order of) child factors
information sorts for elements and attributes
default and fixed values for factors and attributes
Why examine XML Schema
within the XML international, masses of standardized XML formats are in daily use.
lots of these XML requirements are defined by way of XML Schemas.
XML Schema is an XML-primarily based alternative to DTD.
XML Schemas aid information types
one of the best energy of XML Schemas is the aid for records kinds.
it is simpler to explain allowable file content
it's far less difficult to validate the correctness of records
it's far simpler to outline records facets (restrictions on statistics)
it's miles simpler to outline facts patterns (statistics codecs)
it's miles less complicated to transform statistics between different facts kinds
XML Schemas use XML Syntax
another incredible energy approximately XML Schemas is that they may be written in XML.
You don't ought to analyze a new language
you can use your XML editor to edit your Schema documents
you can use your XML parser to parse your Schema documents
you could manipulate your Schema with the XML DOM
you could rework your Schema with XSLT
XML Schemas are extensible, because they are written in XML.
With an extensible Schema definition you can:
Reuse your Schema in different Schemas
Create your personal information types derived from the usual types
Reference a couple of schemas within the same document
XML Schemas relaxed information communique
while sending information from a sender to a receiver, it's far essential that both components have theidentical "expectations" approximately the content.
With XML Schemas, the sender can describe the information in a manner that the receiver will recognize.
A date like: 03-11-2004 will in some countries, be interpreted as 3.November and in other countries as11.March.
an XML detail with a records kind like this:
2004-03-eleven
guarantees a mutual understanding of the content material, due to the fact the XML statistics kind "date"requires the layout "YYYY-MM-DD".
properly-shaped isn't always enough
A well-shaped XML report is a document that conforms to the XML syntax regulations, like:
it must start with the XML declaration
it ought to have one precise root element
begin-tags ought to have matching cease-tags
factors are case sensitive
all elements have to be closed
all factors have to be well nested
all characteristic values ought to be quoted
entities have to be used for unique characters
if files are nicely-fashioned they are able to nonetheless include mistakes, and those mistakes will havecritical consequences.
3)
the steps in this walkthrough reveal a way to use the XSLT debugger. Steps consist of viewing variablesputting breakpoints, and stepping via the code. The fashion sheet reveals all books that value under theaverage ebook price.
To prepare for this walkthrough
near any open solutions.
replica the 2 sample files on your neighborhood computer.
begin Debugging
to start debugging
From the report menu, point to Open, and click on report.
locate the belowAvg.xsl record and click Open.
The fashion sheet is opened inside the XML Editor.
click on the browse button (...) on the input discipline of the report homes window.
discover the books.xml record and click on Open.
This sets the source document document that is used for the XSLT transformation.
proper-click the xsl:if start tag, factor to Breakpoint, and click on Insert Breakpoint.
click the Debug XSL button at the XML Editor toolbar.
This begins the debugging process and opens numerous new home windows that are utilized by the debugger.
There are two home windows that show the enter file and styles sheet. The debugger uses these home windows to expose the contemporary execution kingdom. The debugger is located on the xsl:if element of the fashion sheet and on the first e book node within the books.xml report.
The Locals window displays all of the nearby variables and their modern values. This consists of variablesdescribed within the style sheet and additionally variables that the debugger makes use of to music the nodes which can be presently in context.
The XSL Output window presentations the output of the XSL transformation. This window is separate fromthe visible Studio Output window.
Watch Window
kind bookAverage within the name subject and press input.
The cost of the bookAverage variable is displayed in the window.
type self::node() within the name area and press input.
self node() is an XPath expression that evaluates to the current context node. The price of the self::node() XPath expression is the first book node. This modifications as we development thru the transformation.
enlarge the self::node() node, after which expand the charge node.
This permits you to look the value of the book price and you could easily compare it to the bookAveragevalue. because the e book price is below the average, the xsl:if situation should be successful.
Step thru the Code
The debugger enables you to execute code one line at a time.
To step through the code
Press F5 to retain.
due to the fact the primary e-book node satisfied the xsl:if circumstance, the e book node is added to the XSL output window. The debugger maintains to execute till it's miles positioned once more on the xsl:ifelement in the style sheet. The debugger is now placed on the second book node inside the books.xml file.
inside the Watch1 window the self::node() cost modifications to the second ebook node. via analyzing thecost of the rate element, you can determine that the rate is above the common, for that reason the xsl:ifcondition must fail.
Press F5 to maintain.
because the second book node does no longer meet the xsl:if situation, the book node isn't alwaysbrought to the XSL output window. The debugger maintains to execute until it is placed once more on thexsl:if detail in the style sheet. The debugger is now positioned at the 1/3 e-book node within the books.xmlrecord.
within the Watch1 window the self::node() fee modifications to the 0.33 ebook node. by means ofinspecting the value of the charge detail, you can decide that the fee is below the average, for this reasonthe xsl:if condition ought to be triumphant.
Press F5 to hold.
because the xsl:if condition became glad, the third e-book is delivered to the XSL Output window. All booksin the XML file had been processed and the debugger stops.
belowAvg.xsl
books.xml
-------*-------------------end