Why is this XSLT loop iterating twice? -


i have following xslt snippet:

                <xsl:for-each                     select="distinct-values(/summary/results[@count eq $currentresult]/simulator/host/tps)">                       <th>                         <small>                             tps avg                              <br></br>                         </small>                     </th>                     <th>                         <small>                             tps 95th%tile                              <br></br>                         </small>                     </th>                  </xsl:for-each> 

since, have used distinct-values expect iterate once through loop, iterates twice. twice makes no sense if distinct-values not working properly, there 3 distinct instances of 'tps' in xml document. ideas appreciated...

distinct-values on node:

distinct-values(/summary/results[@count eq $currentresult]/simulator/host/tps 

is different distinct-values on atomic value:

distinct-values(/summary/results[@count eq $currentresult]/simulator/host/tps/avg/text() 

when use node, children of node have identical in order extract 1 entry xml tree.

consider following:

         <tps>            <avg>8.99</avg>            <percentile>11.0</percentile>         </tps>          <tps>            <avg>8.99</avg>            <percentile>11.0</percentile>         </tps>          <tps>            <avg>8.99</avg>            <percentile>10.0</percentile>         </tps> 

you might think select-distinct return 1 entry <tps> here considers children in case. in case above there 2 distinct nodes: avg , percentile identical in 2 of nodes. why looped on for-each twice.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -