XSLT 在XSL中将字符串转换为大写小写

<xsl:template name="ToUpperLowerCase">
                <xsl:param name="inputString"/>
                <xsl:param name="index"/>
                <xsl:param name="loopCount"/>
                <xsl:if test="$index < $loopCount">
                        <xsl:choose>
                                <xsl:when test="substring($inputString, ($index)-1,1) = ' ' or $index = 1">
                                        <xsl:call-template name="ToUpper">
                                                <xsl:with-param name="inputString" select="substring($inputString,$index,1)"/>
                                        </xsl:call-template>
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:call-template name="ToLower">
                                                <xsl:with-param name="inputString" select="substring($inputString,$index,1)"/>
                                        </xsl:call-template>
                                </xsl:otherwise>
                        </xsl:choose>
                        <xsl:call-template name="ToUpperLowerCase">
                                <xsl:with-param name="inputString" select="$inputString"/>
                                <xsl:with-param name="index" select="($index)+1"/>
                                <xsl:with-param name="loopCount" select="$loopCount"/>
                        </xsl:call-template>
                </xsl:if>
        </xsl:template>

        <xsl:template name="ToLower">
                <xsl:param name="inputString"/>
                <xsl:variable name="smallCase" select="'abcdefghijklmnopqrstuvwxyz'"/

                <xsl:variable name="upperCase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/

                <xsl:value-of select="translate($inputString,$upperCase,$smallCase)"/>
        </xsl:template>

        <xsl:template name="ToUpper">
                <xsl:param name="inputString"/>
                <xsl:variable name="smallCase" select="'abcdefghijklmnopqrstuvwxyz'"/

                <xsl:variable name="upperCase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/

                <xsl:value-of select="translate($inputString,$smallCase,$upperCase)"/

        </xsl:template>

XSLT 英镑签到XSLT

<xsl:text disable-output-escaping="yes"><![CDATA[£]]></xsl:text>

XSLT 大写的第一个特征

<!-- generate first character -->
<xsl:value-of select="concat( translate( substring( $MY-STRING, 1, 1 ),$lowerCase, $upperCase ), substring( @type, 2, string-length( $MY-STRING)))" />

<!-- generate remaining string -->
<xsl:value-of select="substring($MY-STRING,2,string-length($MY-STRING)-1)" />

XSLT 选择第一个元素,它具有(至少)1个子元素,其属性“pos”具有值“EN”或“ING”

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="linCorpus/text/body/div[ p/s/w[@pos='EN' or @pos='ING']]">
    <xsl:copy-of select="." />
</xsl:template>          

<xsl:template match="text()" />
</xsl:stylesheet>

XSLT 确定两个节点集是否包含相同的数据

<xsl:if test="count($nodeSet1|$nodeSet2) = count($nodeSet1) and count($nodeSet1) = count($nodeSet2)">
<xsl:text>Node set are the same</xsl:text>
</xsl:if>

XSLT 确保字符串第一个字母大写并且在它结束时完全停止

<!-- first char to uppercase-->
<xsl:value-of select="concat( translate( substring( $my-string, 1, 1 ),$lowerCase, $upperCase ), substring( @type, 2, string-length( $my-string )))" />
<!-- remainder of string -->
<xsl:value-of select="substring($my-string,2,string-length($my-string)-1)" />
<!-- fullstop -->
<xsl:if test="substring($my-string,string-length($my-string)) !='.'">.</xsl:if>

XSLT 在XPath / XSLT中简单解析空间分隔的属性

//div[@class='box-agenda']

XSLT 跳过空的XML节点

<xsl:template name="getValue">
    <xsl:param name="tagId"></xsl:param>
    <xsl:choose>
      <xsl:when test="normalize-space(//item[@id=$tagId]) != ''">
        not empty
      </xsl:when>
      <xsl:otherwise>
        EMPTY
      </xsl:otherwise>
    </xsl:choose>
    Value:<xsl:value-of select="string(//item[@id=$tagId])"/>:
  </xsl:template>

XSLT 的onfocus /的onblur

<input class="search-form__text" type="text" onfocus="this.value=this.value=='Try our search'?'':this.value;" onblur="this.value=this.value==''?'Try our search':this.value;" value="Try our search" />

XSLT 劫持提交或保存共享点列表表单上的按钮以重定向

<!--<SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton2"/>-->
							<input name="Button1" type="button" value="Submit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={/thanks-for-submission.aspx}')}" />