Coding With Fun
Home Docker Django Node.js Articles FAQ

How are xslt-xml templates used to do math?

Asked by Simone Delarosa on Dec 15, 2021 XML

The stylesheet has a single template rule for the source tree's numbers element. This template has a series of xsl:value-of instructions whose select attributes use the values of the numbers element's x, y, and z child elements to do various kinds of math.
With XSLT you can transform an XML document into HTML. XSLT (eXtensible Stylesheet Language Transformations) is the recommended style sheet language for XML. XSLT is far more sophisticated than CSS. With XSLT you can add/remove elements and attributes to or from the output file.
Keeping this in consideration, The next element, <xsl:stylesheet>, defines that this document is an XSLT style sheet document (along with the version number and XSLT namespace attributes). The <xsl:template> element defines a template.
Just so,
The <xsl:template> element is used to build templates. The match attribute is used to associate a template with an XML element.
In fact,
With the node selection, the XPATH expression takes select attribute even by taking multiple nodes like root/child or child1/child2 and so on which results in selecting two element nodes. As templates as types similarly we have a way to invoke templates that instructs the XSLT processor to apply the rule.