java - XSLT: can we use abs value? -
I would like to know whether we can use mathematics in XLST: abs (...)? I saw it somewhere but it does not work. I have something like this:
& lt; Tag & gt; & Lt; Xsl: Select Value = "./Product / BlablaPath" /> & Lt; / Tags & gt;
I tried to do this:
& lt; Tag & gt; & Lt; Xsl: Select the value = "math: stomach (/. Product / blablaPath)" /> & Lt; / Tags & gt;
but does not work I am using Java 1.6 language.
Here is a single XPath expression abs ()
function:
($ x> = 0) * $ x - no ($ x> = 0) * $ x
< Strong> It evaluates abs ($ x)
.
Here is a short description of :
& lt; Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" & gt; & Lt; Xsl: output omit-xml-declaration = "yes" indent = "yes" /> & Lt; Xsl: strip-space element = "*" /> & Lt; Xsl: template match = "node () | @ *" & gt; & Lt; XSL: Copy & gt; & Lt; Xsl: apply-select template = "node () | @ *" /> & Lt; / XSL: Copy & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "text ()" & gt; & Lt; Xsl: choose the ultimate name = "x" = "." / & Gt; & Lt; Xsl: Select value = "($ x> = 0) * $ x - no ($ x> = 0) * $ x" /> & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;
This change applies to the following XML document:
desired, correct results (abs () on each number has been created : < Code> & lt; T & gt; & Lt; Number & gt; 3 & lt; / Number & gt; & Lt; Number & gt; 0 & lt; / Number & gt; & Lt; Number & gt; 5 & lt; / Number & gt; & Lt; / T & gt;
Comments
Post a Comment