Subject: Re: [xsl] When to use text()|
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 21 Mar 2014 16:21:34 +0000
You see an hour ago I wast quite content with my
<xsl:template match="RentAmount | MonthlyAmounts"> <xsl:attribute name="class" select="'money'"/> <xsl:apply-templates/> </xsl:template>
You shouldn't have been really as warnings about over-use of text() come up fairly often:-)
This is why I don't like to post code, because all I really needed from this thread was confirmation that duplicate elimination only applied to node identity rather than content.
Meanwhile ...... if a comment node did infiltrate RentAmount/text() what effect wolud that have with the match pattern and how consistent would it be with the equivalent scenario outside a match pattern.
<xsl:template match="RentAmount/text() | MonthlyAmounts/text()"> <xsl:value-of select="format-number(.,if (xs:decimal(.) > 999.99) then '$,000.00' else '$0.00')"/> </xsl:template>
<xsl:template match="RentAmount| MonthlyAmounts"> <xsl:copy> <xsl:value-of select="format-number(.,if (xs:decimal(.) > 999.99) then '$,000.00' else '$0.00')"/> </xsl:copy> </xsl:template>
________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.