Subject: [xsl] The Oxford Comma - A Gift Worth Atleast 5 Cents From: "Ronnie Royston" <rhroyston@xxxxxxxxx> Date: Thu, 19 Jun 2008 15:40:55 -0500 |
To my esteemed XSLT developers, I submit this simple gift you you with humility. If you ever end up with a variable containing a sequence of 3 or more English words/phrases and want to output good English, paste this in (just change the variable name to whatever). I know this is childs play for all you intelligent folks but hey, maybe it will save someone 10 minutes of typing one day? Just trying to give back to the group that is able to deliver the seemingly impossible..(David) OUTPUTS: "The services also include Cisco IP phone end user training, Cisco attendant console operator training, and Cisco call center agent training." The services also include <xsl:for-each select="$trainingnames"> <xsl:choose> <xsl:when test="count($trainingnames) > 2"> <xsl:choose> <xsl:when test="position()=1"> <xsl:value-of select="concat(' ', .,',')"/> </xsl:when> <xsl:when test="position()=last()"> <xsl:value-of select="concat(' and ', .,'. ')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(' ', .,',')"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="count($trainingnames) = 2"> <xsl:choose> <xsl:when test="position()=1"> <xsl:value-of select="concat(' ', .,' and')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(' ', .,'. ')"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(' ', .,'. ')"/> </xsl:otherwise> </xsl:choose> </xsl:for-each>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Matching two attribute va, Pankaj Chaturvedi | Thread | Re: [xsl] The Oxford Comma - A Gift, ac |
RE: [xsl] Matching two attribute va, Pankaj Chaturvedi | Date | Re: [xsl] XSLT 1.0 support in brows, Greg Fausak |
Month |