Category XML

XSLT Element

An XSL style sheet consists of one or more set of rules that are called templates. A template contains rules to apply when a specified node is matched. The <xsl:template> Element The <xsl:template> element is used to build templates. The…

XSLT – Transformation

Example study: How to transform XML into XHTML using XSLT? The details of this example will be explained in the next chapter. Correct Style Sheet Declaration The root element that declares the document to be an XSL style sheet is…

XSL(T) Languages

XSLT is a language for transforming XML documents. XPath is a language for navigating in XML documents. XQuery is a language for querying XML documents. It Started with XSL XSL stands for EXtensible Stylesheet Language. The World Wide Web Consortium…

XPath Operators

An XPath expression returns either a node-set, a string, a Boolean, or a number. XPath Operators Below is a list of the operators that can be used in XPath expressions :

XPath Axes

The XML Example Document We will use the following XML document in the examples below. <?xml version=”1.0″ encoding=”UTF-8″?> <bookstore> <book>   <title lang=”en”>Harry Potter</title>   <price>29.99</price> </book> <book>   <title lang=”en”>Learning XML</title>   <price>39.95</price> </book> </bookstore>

XPath Syntax

XPath uses path expressions to select nodes or node-sets in an XML document. The node is selected by following a path or steps. The XML Example Document We will use the following XML document in the examples below. <?xml version=”1.0″…

XPath Nodes

XPath Terminology Nodes In XPath, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment, and root nodes. XML documents are treated as trees of nodes. The topmost element of the tree is called the root element.

XML DOM Clone Nodes

Clone a Node The cloneNode() method creates a copy of a specified node. The cloneNode() method has a parameter (true or false). This parameter indicates if the cloned node should include all attributes and child nodes of the original node.…

XML DOM Add Nodes

Add a Node – appendChild() The appendChild() method adds a child node to an existing node. The new node is added (appended) after any existing child nodes. Note: Use insertBefore() if the position of the node is important. This code…