|
XML Home
XML Tutorial About XML XML Viewers XML Editors XML Documents XML Syntax XML Elements XML Attributes XML with CSS XML with XSL XML Namespace XML Local Namespace XML Default Namespace XML Entities XML Creating Entities XML CDATA DTDDTD IntroductionDTD DOCTYPE DTD Internal DTD External DTD Combined DTD FPI DTD Elements DTD Element Operators DTD Attributes DTD Attribute Default Values DTD Attribute Types DTD General Entities DTD Parameter Entities DTD Embedded Images XSLTXSLT IntroductionXSLT Example XSLT Syntax XSLT <template> XSLT <apply-templates> XSLT <value-of> XSLT <for-each> XSLT <sort> XSLT <if> XSLT <choose> XPathXPath IntroductionXPath Location Path XPath Location Path - Absolute XPath Location Path - Relative XPath Attributes XPath Axis XPath Node Test XPath Predicate XPath Node Set XPath Comparison Operators XPath Boolean Operators XPath Number Operators XPath String Functions Tutorial Summary XHTML Tutorial AJAX Tutorial |
XPath Number OperatorsXPath also includes a range of operators you can take advantage of when using number values within your expressions. Number OperatorsHere's a list of number operators you can use in your XPath expressions:
Number FunctionsHere's a list of functions you can use with numbers in your XPath expressions:
Usage ExampleThe Source XML FileWe'll use the following XML file, which contains a list of vegetables and their associated nutritional value:
The RequirementThis time, for each record, we'll display the carbohydrate value ("carbs"). We will also display a column that multiplies the number of carbs by 3 (representing 3 meals per day). Like this:
The SolutionWe could modify the code from the previous lesson so that only the top 5 records are selected. We could achieve this using the XPath
|
Need Website Content?
Get unique, quality digital content for your website.
|