how to apply parallel template definitions in XSLT 2.0
<p>I'm very new to XSLT, and this sample looked like a great way to learn, but for the life of me can't get it to work. I'm trying to tokenize 2 different strings in parallel and combine them into a JSON array. So I want to tokenize measTypes[0] and match to measResults[0], then measTypes[1] and match to measResults[1], and so on</p>

<p>Sample XML</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;measInfo measInfoId="1542455297"&gt;
    &lt;measTypes&gt;1542455297 1542455298 1542455299 1542455300 1542455301 1542455302 1542455303 1542455304 1542455305 1542455306 1542455307 1542460296 1542460297 &lt;/measTypes&gt;
    &lt;measValue measObjLdn="LTHAB0113422/ETHPORT:Cabinet No.=0, Subrack No.=1, Slot No.=7, Port No.=0, Subboard Type=BASE_BOARD"&gt;
        &lt;measResults&gt;116967973 585560 496041572 682500 0 12583680 72080 520454 46670568 73432 2205837 1000000 1000000 &lt;/measResults&gt;
    &lt;/measValue&gt;
    &lt;measValue measObjLdn="LTHAB0113422/ETHPORT:Cabinet No.=0, Subrack No.=1, Slot No.=7, Port No.=1, Subboard Type=BASE_BOARD"&gt;
        &lt;measResults&gt;0 0 0 0 0 0 0 0 0 0 0 0 0 &lt;/measResults&gt;
    &lt;/measValue&gt;
&lt;/measInfo&gt;</code></pre>
</div>
</div>
</p>

<p>XSLT 2.0 that I have so far</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform” xmlns:xs="http://www.w3.org/2001/XMLSchema”  exclude-result-prefixes=“xs"  version="2.0"&gt;
    &lt;xsl:output method="text" encoding="UTF-8" media-type="text/plain"/&gt;
    &lt;xsl:strip-space elements="*"/&gt;
    &lt;!--
    &lt;xsl:template match="/measInfo/measValue/measResults" name="measRes"&gt;
            &lt;xsl:for-each select="."&gt;
            {'measResult':{&lt;xsl:value-of select="tokenize(normalize-space(.),'\s+')"/&gt;}
        &lt;/xsl:for-each&gt;
    &lt;/xsl:template&gt;
    --&gt;
    &lt;xsl:template match="/" name="measObj"&gt;
        [
            &lt;xsl:for-each select="measInfo/measValue"&gt;
            'measObjLdn':'&lt;xsl:value-of select="@measObjLdn"/&gt;'
            &lt;xsl:call-template name="types"/&gt;
            &lt;/xsl:for-each&gt;
        ]
        &lt;xsl:apply-templates /&gt;
    &lt;/xsl:template&gt;
    &lt;xsl:template match="/measInfo" name="types" &gt;
            'Metrics':[
            &lt;xsl:for-each select="tokenize(normalize-space(measTypes),'\s+')"&gt;
                {'measType':'&lt;xsl:value-of select="."/&gt;'},&lt;!-- &lt;xsl:call-template name="measRes"/&gt; --&gt;
            &lt;/xsl:for-each&gt;
            ]
    &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;</code></pre>
</div>
</div>
</p>

<p>The JSON results I'm hoping for</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code> [
            'measObjLdn':"LTHAB0113422/ETHPORT:Cabinet No.=0, Subrack No.=1, Slot No.=7, Port No.=0, Subboard Type=BASE_BOARD",
            'Metrics':[
                {'measType':'1542455297','measResult':116967973},
                {'measType':'1542455298','measResult':585560},
                {'measType':'1542455299','measResult':496041572},
                {'measType':'1542455300','measResult':682500},
                {'measType':'1542455301','measResult':0},
                {'measType':'1542455302','measResult':12583680},
                {'measType':'1542455303','measResult':72080},
                {'measType':'1542455304','measResult':520454},
                {'measType':'1542455305','measResult':46670568},
                {'measType':'1542455306','measResult':73432},
                {'measType':'1542455307','measResult':2205837},
                {'measType':'1542460296','measResult':1000000},
                {'measType':'1542460297','measResult':1000000}
            ]
            'measObjLdn':"LTHAB0113422/ETHPORT:Cabinet No.=0, Subrack No.=1, Slot No.=7, Port No.=1, Subboard Type=BASE_BOARD",
            'Metrics':[
                {'measType':'1542455297','measResult':0},
                {'measType':'1542455298','measResult':0},
                {'measType':'1542455299','measResult':0},
                {'measType':'1542455300','measResult':0},
                {'measType':'1542455301','measResult':0},
                {'measType':'1542455302','measResult':0},
                {'measType':'1542455303','measResult':0},
                {'measType':'1542455304','measResult':0},
                {'measType':'1542455305','measResult':0},
                {'measType':'1542455306','measResult':0},
                {'measType':'1542455307','measResult':0},
                {'measType':'1542460296','measResult':0},
                {'measType':'1542460297','measResult':0}
            ]
        ]</code></pre>
</div>
</div>
</p>