Hello, I'm trying to use a math:max template that I found online, but I need it to work with attributes that may contain a word instead of a number.
Here is the template:
Here is a snippet of my xml:
So, I have a couple of different problems. The first is that I need to pull the highest esdMin and the highest esdMax, no matter where in the tree they live. Unless, I find the work "Call" in either spot. In that case, I need to disregard all of the numbers, and simply display "Call".
The problem I was running into is that the math:max function was returning NaN, due to the work "Call". Anyone see a way around this?
Thanks,
Mike
Here is the template:
Code:
<xsl:template name="math:max">
<xsl:param name="nodes" select="/.." />
<xsl:choose>
<xsl:when test="not($nodes)">NaN</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$nodes">
<xsl:sort data-type="number" order="descending" />
<xsl:if test="position() = 1">
<xsl:value-of select="number(.)" />
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Here is a snippet of my xml:
Code:
<CLASS>
<PART part_number="332234" price="7111" esdMin="Call" esdMax="Call"/>
<PART part_number="331643" price="7411" esdMin="5" esdMax="70"/>
</CLASS>
<PART part_number="331177" price="4415" esdMin="Call" esdMax="Call"/>
<PART part_number="160513" price="415" esdMin="7" esdMax="3"/>
<PART part_number="332636" price="2715" esdMin="72" esdMax="20"/>
<PART part_number="332613" price="1111" esdMin="5" esdMax="70"/>
<PART part_number="331753" price="77411" esdMin="5" esdMax="70"/>
So, I have a couple of different problems. The first is that I need to pull the highest esdMin and the highest esdMax, no matter where in the tree they live. Unless, I find the work "Call" in either spot. In that case, I need to disregard all of the numbers, and simply display "Call".
The problem I was running into is that the math:max function was returning NaN, due to the work "Call". Anyone see a way around this?
Thanks,
Mike