Hier ist ein 8 Jahre alt FXSL 1.x (ein XSLT 1.0 Bibliothek geschrieben vollständig in XSLT 1.0) Lösung:
test-strSplit-to-Words 10.xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://exslt.org/common"
>
<xsl:import href="strSplitWordDel.xsl"/>
<!-- To be applied on: test-strSplit-to-Words10.xml -->
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:variable name="vLower"
select="'abcdefgijklmnopqrstuvwxyz'"/>
<xsl:variable name="vUpper"
select="'ABCDEFGIJKLMNOPQRSTUVWXYZ'"/>
<xsl:template match="/">
<xsl:variable name="vwordNodes">
<xsl:call-template name="str-split-word-del">
<xsl:with-param name="pStr" select="/"/>
<xsl:with-param name="pDelimiters"
select="', .(	 '"/>
</xsl:call-template>
</xsl:variable>
<xsl:apply-templates select="ext:node-set($vwordNodes)/*"/>
</xsl:template>
<xsl:template match="word">
<xsl:choose>
<xsl:when test="not(position() = last())">
<xsl:value-of
select="translate(substring(.,1,1),$vLower,$vUpper)"/>
<xsl:value-of select="substring(.,2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="delim">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Wenn diese Transformation auf dem folgende XML-Dokument (Test-strsplit-to-Words10 angewandt wird.xml):
<t>004.lightning crashes (live).mp3</t>
das Ergebnis ist:
004.Lightning Crashes (Live).mp3
Wenn auf diese XML-Dokument angelegt (Ihre bereitgestellt Probe):
dInEsh sAchdeV kApil Muk
das Ergebnis ist :
DInEsh SAchdeV KApil Muk
Mit nur ein wenig tweek, bekommen wir diesen Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://exslt.org/common"
>
<xsl:import href="strSplitWordDel.xsl"/>
<!-- To be applied on: test-strSplit-to-Words10.xml -->
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:variable name="vLower"
select="'abcdefgijklmnopqrstuvwxyz'"/>
<xsl:variable name="vUpper"
select="'ABCDEFGIJKLMNOPQRSTUVWXYZ'"/>
<xsl:template match="/">
<xsl:variable name="vwordNodes">
<xsl:call-template name="str-split-word-del">
<xsl:with-param name="pStr" select="/"/>
<xsl:with-param name="pDelimiters"
select="', .(	 '"/>
</xsl:call-template>
</xsl:variable>
<xsl:apply-templates select="ext:node-set($vwordNodes)/*"/>
</xsl:template>
<xsl:template match="word">
<xsl:value-of
select="translate(substring(.,1,1),$vLower,$vUpper)"/>
<xsl:value-of select="translate(substring(.,2), $vUpper, $vLower)"/>
</xsl:template>
<xsl:template match="delim">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
die nun das gewünschte Ergebnis produziert:
Dinesh Sachdev Kapil Muk
Erklärung:
Das str-split-word-del
Vorlage FXSL kann für die Tokenisierung mit (möglicherweise mehr als einem) Trennzeichen als String-Parameter verwendet werden.
OP hat die 'xslt-1.0' Tag ...' unteren case' und "Großbuchstaben" ist nicht verfügbar in 1.0 – freefaller
@freefaller Ooh, verpasst das. Wil ändert die Antwort, um dies für zukünftige Referenz zu reflektieren. Vielen Dank! – Kris