IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XSL/XSLT/XPATH XML Discussion :

Utiliser les premiers caractères d'un node pour les utiliser dans une fonction <xsl:if>


Sujet :

XSL/XSLT/XPATH XML

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau candidat au Club
    Inscrit en
    Février 2011
    Messages
    1
    Détails du profil
    Informations forums :
    Inscription : Février 2011
    Messages : 1
    Par défaut Utiliser les premiers caractères d'un node pour les utiliser dans une fonction <xsl:if>
    Bonjour,

    J'assume que je suis un débutant dans l'usage de XSL/XSLT/XPATH, mais je dois "customiser" les templates d'emails d'une application sur plate-forme JAVA qui les emploies (ESKO WebCenter pour ne pas la nommer), et je ne parviens pas à m'y retrouver. Si l'un d'entre vous pouvait m'épauler...

    Voici mon code XLS actu:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- DWXMLSource="approval_due_date_passed_example.xml" -->
    <!DOCTYPE xsl:stylesheet [
      <!ENTITY copy "©">
      <!ENTITY nbsp "*">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:java="http://xml.apache.org/xslt/java" xmlns:XSLUtils="com.esko.webcenter.jsp.XSLUtils" exclude-result-prefixes="XSLUtils java">
    	<xsl:import href="../../Original/URL.xsl"/>
    	<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/>
    	<xsl:param name="w3">http://www.w3.org/</xsl:param>
    	<xsl:key name="langKey" match="/approval_due_date_message/languages/lang_string" use="@key"/>
    	<!-- root template -->
    	<xsl:template match="/approval_due_date_message">
    		<html>
    		<head>
    		<title/>
    		</head>
    		<body alink="#95af00" link="#95af00" vlink="#95af00">
    		<table width="540" align="center" CELLSPACING="0" CELLPADDING="0" style=" color:#565255; font-family:Arial, Helvetica, sans-serif">
    			<tr>
    				<td> <img src="http://www.kcp.be/bridge_datacenter/mailheader_bridge.png"/> </td>
    			</tr>
    			<tr>
    				<td style="text-align: center; font-size: 12pt; font-weight: bold;"> <xsl:value-of select="key('langKey','BODY_APPROVAL_DUE_DATE_PASSED_LABEL')/@value"/> </td>
    			</tr>
    			<xsl:for-each select="projects/project">
    				<tr>
    					<td height="3"><img src="http://www.kcp.be/bridge_datacenter/spacer.png" height="3"/> </td>
    				</tr>
    				<tr>
    					<td bgcolor="#565255">
    						<table width="540px" cellpadding="3" style="text-align:left; font-size: 9pt;">
    							<tr>
    								<td width="227px" style="text-align:right; color:#FFF; font-weight:bold"> <xsl:value-of select="key('langKey','PROJECT_LABEL')/@value"/> </td>
    								<td width="6px">&nbsp;</td>
    								<td width="307px" style="color:#FFF; font-weight:bold"> <xsl:value-of select="project_name"/> </td>
    							</tr>
    						</table>
    					</td>
    				</tr>
    				<xsl:for-each select="documents/document">
    					<tr>
    						<td>
    							<table width="540px" cellpadding="3" style="text-align:left; font-size: 9pt;">
    								<tr>
    									<td width="227px" style="text-align:right"> <xsl:value-of select="key('langKey','NOTBODY_DOC')/@value"/></td>
    									<td width="6px">&nbsp;</td>
    									<td width="307px"> <xsl:value-of select="doc_name"/></td>
    								</tr>
    								<tr>
    									<xsl:if test="doc_due_date">
    										<td style="text-align:right"><xsl:value-of select="key('langKey','NOTBODY_DUEDATE')/@value"/></td>
    										<td>&nbsp;</td>
    										<td><xsl:value-of select="doc_due_date"/></td>
    									</xsl:if>
    								</tr>
    							</table>
    						</td>
    					</tr>
    					<tr>
    						<td height="3"><img src="http://www.kcp.be/bridge_datacenter/spacer.png" height="3"/> </td>
    					</tr>
    				</xsl:for-each>
    			</xsl:for-each>
    			<tr>
    				<td align="center"> <a href="#" target="_blank" style="font-weight:bold; color:#95af00; text-decoration:none;">Go to the Bridge </a> </td>
    			</tr>
    			<tr>
    				<td height="3"><img src="http://www.kcp.be/bridge_datacenter/spacer.png" height="3"/> </td>
    			</tr>
    			<tr>
    				<td> <a href="http://www.kcp.be" target="_blank"><img src="http://www.kcp.be/bridge_datacenter/mailfooter_bridge.png" border="0"/></a> </td>
    			</tr>
    		</table>
    		</body>
    		</html>
    	</xsl:template>
    </xsl:stylesheet>
    J'aimerais extraire les deux premier caractères de la valeur "PROJECT_LABEL" pour me permettre de choisir l'URL que pointera le lien "Go to the Bridge" en fin de code (la branche "propre" au client dans l'autre application de mon système)

    Es-ce possible et si oui, comment?

    Merci

  2. #2
    Membre Expert
    Avatar de Loceka
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    2 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 2 276
    Par défaut
    A priori je dirais qu'il te suffit d'utiliser la fonction substring.

Discussions similaires

  1. [AC-2013] Prendre en compte seulement les premiers caractères pour filtrer
    Par rag83 dans le forum Requêtes et SQL.
    Réponses: 3
    Dernier message: 22/01/2015, 16h45
  2. Réponses: 0
    Dernier message: 04/04/2013, 18h46
  3. [XML] Afficher les premiers caractères d'un flux RSS
    Par metatron dans le forum Bibliothèques et frameworks
    Réponses: 4
    Dernier message: 07/01/2008, 18h40
  4. Réponses: 5
    Dernier message: 20/02/2007, 17h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo