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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
| <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<xsl:element name="L_NOMENC">
<xsl:call-template name="chapitre">
<xsl:with-param name="noeud" select="ROWSET/ROW ">
</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:template>
<xsl:template name="chapitre">
<xsl:param name="noeud">
</xsl:param>
<xsl:param name="ligne" select="$noeud[ART_NOMENC mod 100000000=0]">
</xsl:param>
<xsl:for-each select="$ligne">
<xsl:element name="A">
<xsl:element name="D">
<xsl:value-of select="L_DESC">
</xsl:value-of>
</xsl:element>
<xsl:element name="N">
<xsl:attribute name="sel">
</xsl:attribute>
<xsl:value-of select="ART_NOMENC">
</xsl:value-of>
</xsl:element>
<xsl:call-template name="ecrire_chapi">
<xsl:with-param name="selection" select="$noeud">
</xsl:with-param>
<xsl:with-param name="selection2" select="$ligne">
</xsl:with-param>
<xsl:with-param name="courant" select="position()">
</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template name="ecrire_chapi">
<xsl:param name="selection">
</xsl:param>
<xsl:param name="selection2">
</xsl:param>
<xsl:param name="courant">
</xsl:param>
<xsl:choose>
<xsl:when test="$selection2[$courant+1] ">
<xsl:call-template name="suivant">
<xsl:with-param name="noeud" select="$selection[ ART_NOMENC<$selection2[$courant+1]/ART_NOMENC and ART_NOMENC>$selection2[$courant]/ART_NOMENC]">
</xsl:with-param>
<xsl:with-param name="nb_alin" select="0">
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="suivant">
<xsl:with-param name="noeud" select="$selection [ART_NOMENC>$selection2[$courant]/ART_NOMENC]">
</xsl:with-param>
<xsl:with-param name="nb_alin" select="0">
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="suivant">
<xsl:param name="noeud">
</xsl:param>
<xsl:param name="nb_alin">
</xsl:param>
<xsl:param name="ligne" select="$noeud[number(NB_ALIN)=$nb_alin]">
</xsl:param>
<xsl:for-each select="$ligne">
<xsl:element name="A">
<xsl:element name="D">
<xsl:value-of select="L_DESC">
</xsl:value-of>
</xsl:element>
<xsl:call-template name="ecrire">
<xsl:with-param name="selection" select="$noeud">
</xsl:with-param>
<xsl:with-param name="selection2" select="$ligne">
</xsl:with-param>
<xsl:with-param name="courant" select="position()">
</xsl:with-param>
<xsl:with-param name="alinea" select="$nb_alin">
</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template name="ecrire">
<xsl:param name="selection">
</xsl:param>
<xsl:param name="selection2">
</xsl:param>
<xsl:param name="courant">
</xsl:param>
<xsl:param name="alinea">
</xsl:param>
<xsl:if test="not($selection [number(NB_ALIN)=$alinea+1 and ART_NOMENC=$selection2[$courant]/ART_NOMENC])">
<xsl:element name="N">
<xsl:attribute name="sel">
</xsl:attribute>
<xsl:value-of select="$selection2[$courant]/ART_NOMENC">
</xsl:value-of>
</xsl:element>
</xsl:if>
<xsl:choose>
<xsl:when test="$selection2[$courant+1] ">
<xsl:call-template name="suivant">
<xsl:with-param name="noeud" select="$selection[number(NB_ALIN)>$alinea and ART_NOMENC<$selection2[$courant+1]/ART_NOMENC and ART_NOMENC>=$selection2[$courant]/ART_NOMENC]">
</xsl:with-param>
<xsl:with-param name="nb_alin" select="$alinea+1">
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="suivant">
<xsl:with-param name="noeud" select="$selection [number(NB_ALIN)>$alinea and ART_NOMENC>=$selection2[$courant]/ART_NOMENC]">
</xsl:with-param>
<xsl:with-param name="nb_alin" select="$alinea+1">
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> |
Partager