Subject: Re: [xsl] The Oxford Comma - A Gift Worth Atleast 5 Cents From: ac <ac@xxxxxxxxxxxxx> Date: Thu, 19 Jun 2008 23:46:28 -0400 |
<xsl:stylesheet version="2.0" xmlns:javascript="javascript:code" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xfn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" exclude-result-prefixes="saxon xfn xdt xs xsl javascript">
Cheers, ac
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 -> |
---|---|---|
[xsl] The Oxford Comma - A Gift Wor, Ronnie Royston | Thread | Re: [xsl] The Oxford Comma - A Gift, Colin Paul Adams |
Re: [xsl] XSLT 1.0 support in brows, Greg Fausak | Date | Re: [xsl] The Oxford Comma - A Gift, Colin Paul Adams |
Month |