From: LEFEBVRE Christophe (Christophe.LEFEBVRE@juris-classeur.com)
Date: 18/01/2001 - 10:29
Salut,
Dans la meme veine, comment peut on definir si un attribut est defini en
#IMPLIED dans la DTD ou le schema ? Simple curiosite...
Christophe Lefebvre
Editions du Juris-Classeur
> -----Message d'origine-----
> De: Michael Tartar [mailto:mtartar@cdcixis-sec.com]
> Date: jeudi 18 janvier 2001 10:39
> À: xml-tech@xmlfr.org
> Objet: [xml-tech] Re: Element vide
>
>
> Vous pouvez utiliser les fonctions not() et string-length()
> selon le cas de
> figure présent dans votre fichier XML source :
>
> Cas 1 : L'attribut reportid n'existe pas
> <?xml version="1.0"?>
> <reports>
> <report>le rapport</report>
> </reports>
>
> Cas 2 : L'attribut reportid existe mais est vide
> <?xml version="1.0"?>
> <reports>
> <report reportid="">le rapport</report>
> </reports>
>
> Cas 3 : L'attribut reportid est valué
> <?xml version="1.0"?>
> <reports>
> <report reportid="1">le rapport</report>
> </reports>
>
>
> Feuille XSLT :
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="/">
> <xsl:choose>
> <xsl:when test="not(reports/report[1]/@reportid)">
> <xsl:text>L'attribut reportid n'existe pas</xsl:text>
> </xsl:when>
> <xsl:when test="string-length(reports/report[1]/@reportid)=0">
> <xsl:text>L'attribut reportid existe mais est vide</xsl:text>
> </xsl:when>
> <xsl:otherwise>
> <xsl:text>L'attribut reportid vaut </xsl:text>
> <xsl:value-of select="reports/report[1]/@reportid"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
> </xsl:stylesheet>
>
>
> Cordialement.
>
> Michaël Tartar
>
>
> -----Message d'origine-----
> De: xml-tech-bounce@xmlfr.org [mailto:xml-tech-bounce@xmlfr.org]De la
> part de Sverre Peschardt
> Date: jeudi 18 janvier 2001 09:43
> À: xml-tech@xmlfr.org
> Objet: [xml-tech] Element vide
>
>
>
> Bonjour,
>
> Je souhaite effectuer un test pour savoir si un element ou un
> attribut n'existe pas, comment faire?
>
> Ce serait quelque chose du genre:
> <xsl:if test="{Report/@reportid} = Empty ">
>
> <script>
>
> ........
>
> </script>
>
> </xsl:if>
>
> Merci,
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:05 UTC
webmaster@xmlfr.org
|