Alex deZan
Alex deZan

Reputation: 5

XSLT xsl:choose probem

one of my xml lines looks like this:

<cf_task_subscription amount="1200.0" code="GBP">£1,200.00</cf_task_subscription>

I would like to set up a xls:choose rule like the below but I can't do this because the XML is adding the £ sign:

<xsl:variable name="value" select="/hash/cf_task_subscription"/>
<xsl:choose>
    <xsl:when test="$value > 1200.0">John Doe</xsl:when>
    <xsl:when test="$value = 1200.0">Jane Doe</xsl:when>
    <xsl:otherwise>Unassigned</xsl:otherwise>
</xsl:choose>

so my question is, is there a way I can tell xsl to only consider the amount="1200.00" part of the cf_task_subscription tag?

Thanks,

Upvotes: 0

Views: 25

Answers (1)

Michael Kay
Michael Kay

Reputation: 163595

Since the information has carefully been provided in structured form in attributes, separately from the "display form" in the text node, then take advantage of it:

<xsl:when test="$value/@amount > 1200.0">John Doe</xsl:when>

Upvotes: 1

Related Questions