1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="xml">
<xml><xsl:apply-templates/></xml>
</xsl:template>
<!--Pour créer les signatures-->
<xsl:template match="cahier">
<xsl:call-template name="boucle">
<xsl:with-param name="debut"><xsl:value-of select="descendant::lettre[1]"/></xsl:with-param>
<xsl:with-param name="fin"><xsl:value-of select="descendant::lettre[last()]"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="boucle">
<xsl:param name="debut">ã</xsl:param>
<xsl:param name="fin">z</xsl:param>
<xsl:param name="lettres">ãẽĩõabcdefghiklmnopqrstvxyz</xsl:param>
<xsl:param name="lettres2">ABCDEFGHIKLMNOPQRSTVXYZ</xsl:param>
<xsl:variable name="majuscules">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="minuscules">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<cahier><lettre><xsl:value-of select="$debut"/></lettre><nb><xsl:value-of select="descendant::nb[last()]"/></nb><xsl:text>
</xsl:text></cahier>
<xsl:choose>
<xsl:when test="matches($debut,'^.$')">
<xsl:variable name="debut2" select="$debut"/>
<xsl:variable name="position" select="string-length(substring-before($lettres, $debut2)) + 1"/>
<xsl:variable name="suivant">
<xsl:value-of select="substring($lettres, $position +1, 1)"/>
</xsl:variable>
<xsl:if test="$suivant != '' and $debut2 != $fin">
<xsl:call-template name="boucle">
<xsl:with-param name="debut" select="$suivant"/>
<xsl:with-param name="fin" select="$fin"/>
<xsl:with-param name="lettres" select="$lettres"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:when test="matches($debut,'^..$')">
<xsl:variable name="debut2" select="substring($debut,1,1)"/>
<xsl:variable name="position" select="string-length(substring-before($lettres2, $debut2)) + 1"/>
<xsl:variable name="suivant">
<xsl:value-of select="substring($lettres2, $position +1, 1)"/>
<xsl:value-of select="translate(substring($lettres2, $position +1, 1),$majuscules,$minuscules)"/>
</xsl:variable>
<xsl:if test="$suivant != '' and $debut2 != $fin">
<xsl:call-template name="boucle">
<xsl:with-param name="debut" select="$suivant"/>
<xsl:with-param name="fin" select="$fin"/>
<xsl:with-param name="lettres" select="$lettres2"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:when test="matches($debut,'^...$')">
<xsl:variable name="debut2" select="substring($debut,1,1)"/>
<xsl:variable name="position" select="string-length(substring-before($lettres2, $debut2)) + 1"/>
<xsl:variable name="suivant">
<xsl:value-of select="substring($lettres2, $position +1, 1)"/>
<xsl:value-of select="substring($lettres2, $position +1, 1)"/>
<xsl:value-of select="translate(substring($lettres2, $position +1, 1),$majuscules,$minuscules)"/>
</xsl:variable>
<xsl:if test="$suivant != '' and $debut2 != $fin">
<xsl:call-template name="boucle">
<xsl:with-param name="debut" select="$suivant"/>
<xsl:with-param name="fin" select="$fin"/>
<xsl:with-param name="lettres" select="$lettres2"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> |
Partager