[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Capitalize first letter of 'ContractName' with xsl
From: |
Boutin, Wendy |
Subject: |
[lmi] Capitalize first letter of 'ContractName' with xsl |
Date: |
Thu, 3 Dec 2015 15:37:23 +0000 |
We have a new variable, 'ContractName', which is used in
'nasd.xsl'. It contains a text string with all lower case
letters. I need to use that variable in certain places of
the output where it begins a sentence, which means it needs
a capitalized first letter. Is it possible that you could
help reformat this variable in the xsl file?
I found and tried a few samples online, notably this one:
http://stackoverflow.com/questions/9611569/xsl-how-do-you-capitalize-first-letter
, but was unsuccessful adapting it to my specific needs. I just
don't have enough experience to know what I'm missing. Here's
what I've done (among many other variations), but I'm sure you
can see clearly what's wrong:
--- nasd.xsl 2015-11-27 06:19:26.209517400 -0500
+++ nasd-ContractName.xsl 2015-12-03 10:28:16.000000000 -0500
@@ -24 +24 @@
- $Id: nasd.xsl 6424 2015-11-23 23:19:18Z chicares $
+ $Id: nasd.xsl 6081 2015-01-09 00:38:05Z chicares $
@@ -31,0 +32,40 @@
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:variable name="vLower" select=
+ "'abcdefghijklmnopqrstuvwxyz'"/>
+
+ <xsl:variable name="vUpper" select=
+ "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
+
+ <xsl:variable name="contract_name" select="$scalars/ContractName =
'contract'"/>
+
+<!--
+ <xsl:template match="/*">
+ <xsl:apply-templates/><xsl:value-of select="$scalars/ContractName"/>
+ </xsl:template>
+
+ <xsl:template match='<xsl:value-of select="$scalars/ContractName"/>'
+ <xsl:sequence select=
+ "concat(translate(substring(.,1,1), $vLower, $vUpper),
+ substring(., 2),
+ substring(' ', 1div not(position()=last()))
+ )
+ "/>
+ </xsl:template>
+
+********ORIGINAL EXAMPLE**********
+
+<xsl:template match="/*">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="First|Last">
+ <xsl:value-of select=
+ "concat(translate(substring(.,1,1), $vLower, $vUpper),
+ substring(., 2),
+ substring(' ', 1 div not(position()=last()))
+ )
+ "/>
+ </xsl:template>
+-->
This e-mail transmission may contain information that is proprietary,
privileged and/or confidential and is intended exclusively for the person(s) to
whom it is addressed. Any use, copying, retention or disclosure by any person
other than the intended recipient or the intended recipient's designees is
strictly prohibited. If you are not the intended recipient or their designee,
please notify the sender immediately by return e-mail and delete all copies.
- [lmi] Capitalize first letter of 'ContractName' with xsl,
Boutin, Wendy <=