HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Case study: how to use XSLT to transform XML into XHTML.
We will detail in the next chapter of this example will be explained.
The document declared as XSL stylesheet root element is <xsl: stylesheet> or <xsl: transform>.
Note: <xsl: stylesheet> and <xsl: transform> are completely synonymous and can be used!
According to the W3C XSLT standards, the correct way to declare an XSL stylesheet is:
or:
To access XSLT elements, attributes and characteristics, we must at the top of the document namespace declaration XSLT.
xmlns: xsl = "#" points to official W3C XSLT namespace. If you use this namespace, it must include the attribute version = "1.0".
We now want the following XML document ( "cdcatalog.xml")is converted to XHTML:
See XML file in Firefox and Internet Explorer: Open the XML file (usually by clicking on a link) - XML document will color code of ways to display the root element and child elements.Click on the left side of the element plus sign (+) or minus (-) to expand or shrink structural elements. To view the original XML source file (without the plus and minus signs), select "View Page Source" or "View Source" in your browser menu.
Check the XML file in Netscape 6: Open theXML file, then right-click in XML file and select "View Page Source." XML document will color code of ways to display the root element and child elements.
Check the XML file in Opera 7: Open theXML file, then right-click in the XML file, select "Frame" / "View Source." XML document will be displayed as plain text.
Then create a template conversion XSL stylesheet with ( "cdcatalog.xsl"):
The XML document ( "cdcatalog.xml") to add a reference to an XSL style sheet:
If you're using a browser compatible with XSLT, it would be well to put your XMLinto XHTML.
We will in the next chapter of the above example to explain the details.