Yet another category which has no direct support in XSLT v1.0 or XSLT v2.0!
However, given the strong support for scientific functions in .NET, it’s easy to call
out to .NET classes, which is exactly what every single one of the functoids in this
category does.
Having said that: have you ever used one of these functoids in a map? Care to share
a real world example?
I’d be interested to find out how often they are used.
For each functoid I’ve shown:
- Whether XSLT or C# is emitted
- Whether an XSLT equivalent exists
- The XSLT or C# emitted by the functoid
- Where C# is emitted, the equivalent XSLT to achieve the same functionality (in both
XSLT v1.0 and v2.0)
Functoids covered in this category:
| 10^n | Natural Logarithm |
| Arc Tangent | Sine |
| Base-Specified Logarithm | Tangent |
| Common Logarithm | X^Y |
| Cosine | Common Code |
| Natural Exponential Function |
The other posts in this series are (links will become active as the posts become active):
Understanding
the BizTalk Mapper: Part 1 – IntroductionUnderstanding
the BizTalk Mapper: Part 2 – Functoids Overview
Understanding
the BizTalk Mapper: Part 3 – String Functoids
Understanding
the BizTalk Mapper: Part 4 – Mathematical Functoids
Understanding
the BizTalk Mapper: Part 5 – Logical Functoids
Understanding
the BizTalk Mapper: Part 6 – Date/Time Functoids
Understanding
the BizTalk Mapper: Part 7 – Conversion Functoids
Understanding the BizTalk Mapper: Part 8 – Scientific Functoids
Understanding the BizTalk Mapper: Part 9 – Cumulative Functoids>
Understanding
the BizTalk Mapper: Part 10 – Database Functoids
Understanding
the BizTalk Mapper: Part 11 – Advanced Functoids
Understanding
the BizTalk Mapper: Part 12 – Performance and Maintainability
Download the complete series as a single Microsoft
Word document (1.2MB) or Adobe
PDF document (620kb).
| Scientific Functoids | ||
| Note: XSLT has no intrinsic trigonometric functions, although you can download open source libraries such as FXSL |
||
| 10^n | ||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciExp10(string val)
{ string retval double dval if (IsNumeric(val, ref dval)) { double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Arc Tangent | ||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciArcTan(string val)
{ string retval double dval if (IsNumeric(val, ref dval)) { double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Base-Specified Logarithm |
||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciLogn(string val1, string val2)
{ string retval double dval1 double dval2 if (IsNumeric(val1, ref dval1) { if (dval1
double denom if (denom
double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Common Logarithm | ||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciLog10(string val)
{ string retval double dval if (IsNumeric(val, ref dval)) { if (dval
double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Cosine | ||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciCos(string val)
{ string retval double dval if (IsNumeric(val, ref dval)) { double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Natural Exponential Function |
||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciExp(string val)
{ string retval double dval if (IsNumeric(val, ref dval)) { double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Natural Logarithm | ||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciLog(string val)
{ string retval double dval if (IsNumeric(val, ref dval)) { if (dval
double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Sine | ||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciSin(string val)
{ string retval double dval if (IsNumeric(val, ref dval)) { double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Tangent | ||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciTan(string val)
{ string retval double dval if (IsNumeric(val, ref dval)) { double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| X^Y | ||
| Generates: C# | Has XSLT Equivalent: No | |
| Emitted Code:public string SciPow(string val1, string val2)
{ string retval double dval1 double dval2 if (IsNumeric(val1, ref dval1) { double ret
} return retval; } |
||
| XSLT 1.0 Equivalent: (none) | ||
| XSLT 2.0 Equivalent: (none) | ||
| Common Code(this is common code used by all the scientific functoids) | ||
| public bool IsNumeric(string val){
if (val { return false; } double d return Double.TryParse(val, }
public bool IsNumeric(string val, ref double d) { if (val { return false; } return Double.TryParse(val, } |
||
