Академический Документы
Профессиональный Документы
Культура Документы
XML
What is XML? XML is custom markup language XML should be self explanatary and the tags should contain data example
XML
Rules to Write XML: XML is defined by set of rules, if you adhere to the following rules it is said to be well formed.
A root element is required Closing tags are required. Rules Example Elements must be properly nested. If you start an Element A and start an Element B , you should first close Element B and then Element A. Contd
XML
Case Matters.
XML is case sensitive. Elements named wonder, Wonder and WONDER are treated entirely seperate and unrelated. <name>Colossus of Rhodes</name> <Name>Colossus of Rhodes</Name> <name>Colossus of Rhodes</Name>
XML
Elements , Attributes and values Syntax of XML Element Tag : <Element>Content</Element> Eg: <height>107</height> Syntax of XML Tag with attribute : <Element AttrName=[Attrvalue]>Content</Element> Eg: <height units="feet"> 107 </height> Note: Attribute is generally considered as metadata.
XML
Creating XML <?xml version="1.0"?> - > Begin with Processing instruction. -> Create root element -> No limit to child elements. -> Nesting elements. -> usage of attributes as required -> usage of empty elements <main_image file="colossus.jpg" w="528" h="349"/>
XML
-> Writing comments <!--this is a comment--> Comment Example : -> Displaying elements as text use CDATA
HTML
HTML - Hyper Text Markup Language
XSLT
we use XSLT to transform XML documents and produce HTML. Process : The process starts with two documents -> the XML document which contain the source data to be transformed -> The XSLT- a style sheet document which describes the rules of the transformation.
XSLT
Transformation Steps The XSLT Processor analyses the XML document and converts into a node tree. After then , it looks at the style sheet for instruction on what to do with the nodes.
XSLT
XSLT Templates The instructions are contained in templates Each template has two instructions ; - label that identifies the nodes in the XML document - Instructions about the actual transformation. ex: - 02-03.xsl Note : All XSLT transformations should start with root template. <xsl:template match="/"> </xsl:template> ex : 2.6
XSLT
Outputting HTML <xsl:output method="html"/> -> add the above line to direct the output to html. -> you can add the HTML tags inside the <xsl:template match="/"></xsL:template> ex : 2.7
XSLT
Outputting Values To output a node's content, provide <xsl:value-of select="expression" />
XSLT
Looping over nodes <xsl:for-each>
XSLT
Processing nodes conditionally <xsl:if test="name[@language!='English']"> IF element allows you to act only when provided test pass
XSLT
sorting nodes <xsl:sort select="height" order="descending" datatype="number" /> Sort element will sort the nodes in ascending/descending order based on the attribute order