Nombre en alsacien
1. 234. 567 = eimillionzweihundertviaradrissigtàuisigfìmfhundertsìewenasachzig
Nombre audio
ei
million
zwei
hundert
viara
drissig
tàuisig
fìmf
hundert
sìewena
sachzig
Montrer le détail du traitement
Déployer tous les contenus
1234567
>
Montrer le détail
épelle le nombre en toutes lettres, par la transformation
transfo_
nombre
_xml.xsl
?
↓ XSL
<?xml version ="1.0" encoding="UTF-8"?> <!-- Nom de fichier : transfo_nombre_xml.xsl --> <!-- Creation : Milib le 25/01/2015 --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8"/> <xsl:template match="/"> <!-- link rel="stylesheet" type="text/css" href="style_num.css"/ --> <xsl:variable name="espace"><xsl:text> </xsl:text></xsl:variable> <xsl:variable name="rien"><xsl:text></xsl:text></xsl:variable> <xsl:variable name="num"> <xsl:call-template name="string-replace-all"> <xsl:with-param name="text" select="nombre" /> <xsl:with-param name="replace" select="$espace" /> <xsl:with-param name="by" select="$rien" /> </xsl:call-template> </xsl:variable> <xsl:variable name="longueur" select="string-length($num)" /> <nombre> <decompose> <xsl:if test="substring($num, $longueur - 14, 3)"> <xsl:value-of select="substring($num, $longueur - 14, 3)"/>. </xsl:if> <xsl:if test="substring($num, $longueur - 11, 3)"> <xsl:value-of select="substring($num, $longueur - 11, 3)"/>. </xsl:if> <xsl:if test="substring($num, $longueur - 8, 3)"> <xsl:value-of select="substring($num, $longueur - 8, 3)"/>. </xsl:if> <xsl:if test="substring($num, $longueur - 5, 3)"> <xsl:value-of select="substring($num, $longueur - 5, 3)"/>. </xsl:if> <xsl:if test="substring($num, $longueur - 2, 3)"> <xsl:value-of select="substring($num, $longueur - 2, 3)"/> </xsl:if> </decompose> <text> <xsl:choose> <xsl:when test="$num='0'"> <elem>null</elem> </xsl:when> <xsl:when test="$num='1'"> <elem>eins</elem> </xsl:when> <xsl:when test="string-length($num) > 17"> Nombre trop grand </xsl:when> <xsl:otherwise> <xsl:if test="substring($num, $longueur - 14, 3)"> <xsl:if test="substring($num, $longueur - 14, 3) != '000' and substring($num, $longueur - 14, 3) != '00' and substring($num, $longueur - 14, 3) != '0' "> <xsl:if test="substring($num, $longueur - 14, 3) != '1' and substring($num, $longueur - 14, 3) != '001' "> <!-- pas de "ei" pour "1" devant "tàuisig --> <xsl:call-template name="nombre1a999"> <xsl:with-param name="nbre" select="substring($num, $longueur - 14, 3)"/> <xsl:with-param name="fin" select="0"/> </xsl:call-template> </xsl:if> <elem>tàuisig</elem> </xsl:if> </xsl:if> <xsl:if test="substring($num, $longueur - 11, 3)"> <xsl:if test="$longueur > 9"> <!-- cas où il y a du contenu dans la plage "milliard", non limitée en grandeur --> <xsl:call-template name="nombre1a999"> <xsl:with-param name="nbre" select="substring($num, $longueur - 11, 3)"/> <xsl:with-param name="fin" select="0"/> </xsl:call-template> <elem>milliarda</elem> <!-- on dit aussi : 1 Milliarda --> </xsl:if> </xsl:if> <xsl:if test="substring($num, $longueur - 8, 3)"> <xsl:if test="substring($num, $longueur - 8, 3) != '000' and substring($num, $longueur - 8, 3) != '00' and substring($num, $longueur - 8, 3) != '0' "> <!-- cas où il y a du contenu dans la plage "million" --> <xsl:call-template name="nombre1a999"> <xsl:with-param name="nbre" select="substring($num, $longueur - 8, 3)"/> <xsl:with-param name="fin" select="0"/> </xsl:call-template> <elem>million<xsl:if test="substring($num, $longueur - 8, 3) != '1' and substring($num, $longueur - 8, 3) != '001'">a</xsl:if></elem> </xsl:if> </xsl:if> <xsl:if test="substring($num, $longueur - 5, 3)"> <xsl:if test="substring($num, $longueur - 5, 3) != '000' and substring($num, $longueur - 5, 3) != '00' and substring($num, $longueur - 5, 3) != '0' "> <!-- cas où il y a du contenu dans la plage "tàuisig" --> <xsl:if test="substring($num, $longueur - 5, 3) != '1' and substring($num, $longueur - 5, 3) != '001' "> <!-- pas de "ei" pour "1" devant "tàuisig --> <xsl:call-template name="nombre1a999"> <xsl:with-param name="nbre" select="substring($num, $longueur - 5, 3)"/> <xsl:with-param name="fin" select="0"/> </xsl:call-template> </xsl:if> <elem>tàuisig</elem> </xsl:if> </xsl:if> <xsl:if test="substring($num, $longueur - 2, 3)"> <!-- la fin du nombre --> <xsl:call-template name="nombre1a999"> <xsl:with-param name="nbre" select="substring($num, $longueur - 2, 3)"/> <xsl:with-param name="fin" select="1"/> </xsl:call-template> </xsl:if> </xsl:otherwise> </xsl:choose> </text> </nombre> </xsl:template> <!-- ============= TRAITEMENT DE REMPLACEMENT ============= --> <!-- Trouve sur http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx --> <!-- ou aussi http://stackoverflow.com/questions/3067113/xslt-string-replace --> <xsl:template name="string-replace-all"> <xsl:param name="text" /> <xsl:param name="replace" /> <xsl:param name="by" /> <xsl:choose> <xsl:when test="contains($text, $replace)"> <xsl:value-of select="substring-before($text,$replace)" /> <xsl:value-of select="$by" /> <xsl:call-template name="string-replace-all"> <xsl:with-param name="text" select="substring-after($text,$replace)" /> <xsl:with-param name="replace" select="$replace" /> <xsl:with-param name="by" select="$by" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text" /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="nombre1a999"> <xsl:param name="nbre" /> <xsl:param name="fin" /> <xsl:if test="string-length($nbre) = 3"> <xsl:if test="substring($nbre, 1, 1) != '0'"> <elem> <xsl:choose> <xsl:when test="substring($nbre, 1, 1) = '1'"></xsl:when> <xsl:when test="substring($nbre, 1, 1) = '2'">zwei</xsl:when> <xsl:when test="substring($nbre, 1, 1) = '3'">drèi</xsl:when> <xsl:when test="substring($nbre, 1, 1) = '4'">viar</xsl:when> <xsl:when test="substring($nbre, 1, 1) = '5'">fìmf</xsl:when> <xsl:when test="substring($nbre, 1, 1) = '6'">sechs</xsl:when> <xsl:when test="substring($nbre, 1, 1) = '7'">sìewa</xsl:when> <xsl:when test="substring($nbre, 1, 1) = '8'">àcht</xsl:when> <xsl:when test="substring($nbre, 1, 1) = '9'">niin</xsl:when> </xsl:choose> </elem> <elem>hundert</elem> </xsl:if> <xsl:call-template name="nombre1a99"> <xsl:with-param name="nbre" select="substring($nbre, 2, 2)"/> <xsl:with-param name="fin" select="$fin"/> </xsl:call-template> </xsl:if> <xsl:if test="string-length($nbre) = 1 or string-length($nbre) = 2"> <xsl:call-template name="nombre1a99"> <xsl:with-param name="nbre" select="$nbre"/> <xsl:with-param name="fin" select="$fin"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template name="nombre1a99"> <xsl:param name="nbre" /> <xsl:param name="fin" /> <xsl:choose> <xsl:when test="$nbre='1' or $nbre='01' or $nbre='001'"><elem>ei<xsl:if test="$fin='1'">ns</xsl:if></elem></xsl:when> <xsl:when test="$nbre='2' or $nbre='02' or $nbre='002'"><elem>zwei</elem></xsl:when> <xsl:when test="$nbre='3' or $nbre='03' or $nbre='003'"><elem>drèi</elem></xsl:when> <xsl:when test="$nbre='4' or $nbre='04' or $nbre='004'"><elem>viar</elem></xsl:when> <xsl:when test="$nbre='5' or $nbre='05' or $nbre='005'"><elem>fìmf</elem></xsl:when> <xsl:when test="$nbre='6' or $nbre='06' or $nbre='006'"><elem>sechs</elem></xsl:when> <xsl:when test="$nbre='7' or $nbre='07' or $nbre='007'"><elem>sìewa</elem></xsl:when> <xsl:when test="$nbre='8' or $nbre='08' or $nbre='008'"><elem>àcht</elem></xsl:when> <xsl:when test="$nbre='9' or $nbre='09' or $nbre='009'"><elem>niin</elem></xsl:when> <xsl:when test="$nbre='10'"><elem>zeh</elem></xsl:when> <xsl:when test="$nbre='11'"><elem>elf</elem></xsl:when> <xsl:when test="$nbre='12'"><elem>zwälf</elem></xsl:when> <xsl:when test="$nbre='13'"><elem>dritzeh</elem></xsl:when> <xsl:when test="$nbre='14'"><elem>viarzeh</elem></xsl:when> <xsl:when test="$nbre='15'"><elem>fufzeh</elem></xsl:when> <xsl:when test="$nbre='16'"><elem>sachzeh</elem></xsl:when> <xsl:when test="$nbre='17'"><elem>sìbzeh</elem></xsl:when> <xsl:when test="$nbre='18'"><elem>àchtzeh</elem></xsl:when> <xsl:when test="$nbre='19'"><elem>niinzeh</elem></xsl:when> <xsl:otherwise> <elem> <xsl:call-template name="unite"> <xsl:with-param name="nbre" select="substring($nbre, 2, 1)" /> </xsl:call-template> </elem> <elem> <xsl:call-template name="dizaine"> <xsl:with-param name="nbre" select="substring($nbre, 1, 1)" /> </xsl:call-template> </elem> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="unite"> <xsl:param name="nbre" /> <xsl:choose> <xsl:when test="$nbre = '0'"></xsl:when> <xsl:when test="$nbre = '1'">eina</xsl:when> <xsl:when test="$nbre = '2'">zweia</xsl:when> <xsl:when test="$nbre = '3'">drèia</xsl:when> <xsl:when test="$nbre = '4'">viara</xsl:when> <xsl:when test="$nbre = '5'">fìmfa</xsl:when> <xsl:when test="$nbre = '6'">sechsa</xsl:when> <xsl:when test="$nbre = '7'">sìewena</xsl:when> <xsl:when test="$nbre = '8'">àchta</xsl:when> <xsl:when test="$nbre = '9'">niina</xsl:when> </xsl:choose> </xsl:template> <xsl:template name="dizaine"> <xsl:param name="nbre" /> <xsl:choose> <xsl:when test="$nbre = '2'">zwànzig</xsl:when> <xsl:when test="$nbre = '3'">drissig</xsl:when> <xsl:when test="$nbre = '4'">viarzig</xsl:when> <xsl:when test="$nbre = '5'">fufzig</xsl:when> <xsl:when test="$nbre = '6'">sachzig</xsl:when> <xsl:when test="$nbre = '7'">sìbzig</xsl:when> <xsl:when test="$nbre = '8'">àchtzig</xsl:when> <xsl:when test="$nbre = '9'">niinzig</xsl:when> </xsl:choose> </xsl:template> </xsl:stylesheet>
Résultat
1. 234. 567
ei
million
zwei
hundert
viara
drissig
tàuisig
fìmf
hundert
sìewena
sachzig
v
^
Montrer le détail
affiche le nombre en toutes lettres, par la transformation
transfo_
nombre_affiche
_html.xsl
?
↓ XSL
<?xml version ="1.0" encoding="UTF-8"?> <!-- Nom de fichier : transfo_nombre_affiche_html.xsl --> <!-- Creation : MiLib - 01/03/2015 - Licence GPL --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> <html> <head> <title>Nombre en alsacien</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="description" content="nombre écrit en alsacien"/> </head> <body> <xsl:value-of select="nombre/decompose"/> = <xsl:value-of select="nombre/text"/> </body> </html> </xsl:template> </xsl:stylesheet>
Résultat
Nombre en alsacien
1. 234. 567 = eimillionzweihundertviaradrissigtàuisigfìmfhundertsìewenasachzig
-
^
Montrer le détail
écoute audio du nombre, par la transformation
transfo_
nombre_audio
_html.xsl
?
↓ XSL
<?xml version ="1.0" encoding="UTF-8"?> <!-- Nom de fichier : transfo_nombre_audio_html.xsl --> <!-- Repris de : siteAlsa_IPA_html.xsl --> <!-- Creation : MiLib - 14/02/2015 - Licence GPL --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> <!-- html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" --> <html> <head> <title>Nombre audio</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="description" content="Texte audio"/> <STYLE type="text/css"> span.elem_nombre { border: 1px dotted grey; color: #000000; background-color:#FFFFFF; } </STYLE> <script src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <SCRIPT> $(document).ready(function(){ // Joue la succession des players audio $("input#play_audioV1").click(function(){ var nowPlaying; nowPlaying = $("#playerV1_0").get(0); nowPlaying.load(); nowPlaying.play(); nowPlaying = null; $('#playerV1_0').on('ended', function(){ <xsl:for-each select="nombre/text/elem"> <xsl:if test=".!=''"> nowPlaying = $("#playerV1_<xsl:value-of select='position()'/>_<xsl:value-of select='.'/>").get(0); nowPlaying.load(); nowPlaying.play(); nowPlaying = null; $("#span_<xsl:value-of select='position()'/>_<xsl:value-of select='.'/>").css({ 'border' : '1px dotted red', 'color' : '#A00000', 'background-color' : '#FFF0F0' }); $('#playerV1_<xsl:value-of select='position()'/>_<xsl:value-of select='.'/>').on('ended', function(){ </xsl:if> </xsl:for-each> nowPlaying.load(); nowPlaying.play(); nowPlaying = null; <xsl:for-each select="nombre/text/elem"> <xsl:if test=".!=''">}); </xsl:if> </xsl:for-each> }); }); $("input#play_audioV2").click(function(){ var nowPlaying; nowPlaying = $("#playerV2_0").get(0); nowPlaying.load(); nowPlaying.play(); nowPlaying = null; $('#playerV2_0').on('ended', function(){ <xsl:for-each select="nombre/text/elem"> <xsl:if test=".!=''"> nowPlaying = $("#playerV2_<xsl:value-of select='position()'/>_<xsl:value-of select='.'/>").get(0); nowPlaying.load(); nowPlaying.play(); nowPlaying = null; $("#span_<xsl:value-of select='position()'/>_<xsl:value-of select='.'/>").css({ 'border' : '1px dotted green', 'color' : '#00A000', 'background-color' : '#F0FFF0' }); $('#playerV2_<xsl:value-of select='position()'/>_<xsl:value-of select='.'/>').on('ended', function(){ </xsl:if> </xsl:for-each> nowPlaying.load(); nowPlaying.play(); nowPlaying = null; <xsl:for-each select="nombre/text/elem"> <xsl:if test=".!=''">}); </xsl:if> </xsl:for-each> }); }); }); </SCRIPT> </head> <body> <audio id="playerV1_0"><source src="son/silence.mp3"/> </audio> <xsl:for-each select="nombre/text/elem"> <xsl:if test=".!=''"> <audio id="playerV1_{position()}_{.}"><source src="son/1/{.}.mp3"/></audio> </xsl:if> </xsl:for-each> <audio id="playerV2_0"><source src="son/silence.mp3"/> </audio> <xsl:for-each select="nombre/text/elem"> <xsl:if test=".!=''"> <audio id="playerV2_{position()}_{.}"><source src="son/2/{.}.mp3"/></audio> </xsl:if> </xsl:for-each> <xsl:for-each select="nombre/text/elem"> <xsl:if test=".!=''"> <span id="span_{position()}_{.}" class="elem_nombre"><xsl:value-of select="."/></span> </xsl:if> </xsl:for-each> <br/><br/> <input type="button" id="play_audioV1" value="Ecouter le son" /> <xsl:text> </xsl:text> <input type="button" id="play_audioV2" value="Ecouter autre voix" /> </body> </html> </xsl:template> </xsl:stylesheet>
Résultat
Nombre audio
ei
million
zwei
hundert
viara
drissig
tàuisig
fìmf
hundert
sìewena
sachzig
-