I have the following code that contains 3 variables which values depend on an xml.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:date="java.util.Date"
xmlns:vector="java.util.Vector"
xmlns:math="java.lang.Math"
xmlns:int="java.lang.Integer"
xmlns:saxon="http://saxon.sf.net/"
extension-element-prefixes="date vector math int saxon">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:variable name="var1">
code to generate the value
</xsl:variable>
<xsl:variable name="var2">
code to generate the value
</xsl:variable>
<xsl:variable name="var3">
code to generate the value
</xsl:variable>
The problem is that I have to combine this values for another variable:
<xsl:variable name="var4">
value = var1 | var2 | var3
</xsl:variable>
Is there an elegant way of doing this? I have already looked at this answer but I did not find it useful.
The only solution that comes to my mind is
- Transform the numbers into strings containing their binary representation
- Take 2 strings and compare each letter and hold the result
- Take the result and compare it with the last string
- Transform the binary representation back to integer