🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.text.xml
Article #9456

XSL : ajouter du texte apres un element

#9456
From: Stephane Legrand
Date: Tue, 10 Apr 2001 22:37
62 lines
2272 bytes
Bonjour,

Je pr�cise tout de suite que je d�bute en XSL donc merci de votre
indulgence. Je cherche � faire la transformation suivante :


XHTML d'origine :

<html>
...
<body ...>
<p>test</p>
</body>
</html>

XHTML final :

<html>
...
<body ...>
<p>ajout apres debut body</p>
<p>test</p>
<p>ajout avant fin body</p>
</body>
</html>


J'ai essay� avec le XSL suivant :

<xsl:template match="body">
  <body>
  <xsl:for-each select="@*">
    <xsl:attribute name="name()">
      <xsl:value-of select="."/>
    </xsl:attribute>
  </xsl:for-each>
  <p>ajout apres debut body</p>
  <xsl:apply-templates/>
  <p>ajout avant fin body</p>
  </body>
</xsl:template>
<xsl:template match="@*|node()[not(name()='body')]">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

mais cela a uniquement pour effet de supprimer <body ...> et </body>
du code XHTML. Pourquoi le template associ� � "body" ne semble pas
appliqu� ? Comment faire pour qu'il le soit tout en conservant la
copie des autres �l�ments ?

J'utilise Sablotron version 0.51 sous FreeBSD.


Merci.

St�phane.

-- 
Stephane.Legrand@bigfoot.com
FreeBSD Francophone : http://www.freebsd-fr.org/
Technical Details
Message-ID: <slrn9d72nn.hdq.Stephane.Legrand@sequoia.mondomaineamoi.megalo>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!freenix!fr.usenet-edu.net!usenet-edu.net!proxad.net!feeder2.proxad.net!nnrp1.proxad.net.POSTED!Stephane.Legrand

Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII
X-Google-Thread: 114f60,6d96fc73104fc38b,start
X-Google-Attributes: gid114f60,public
X-Google-ArrivalTime: 2001-04-10 15:38:20 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!freenix!fr.usenet-edu.net!usenet-edu.net!proxad.net!feeder2.proxad.net!nnrp1.proxad.net.POSTED!Stephane.Legrand
From: Stephane.Legrand@bigfoot.com (Stephane Legrand)
Newsgroups: fr.comp.text.xml
Subject: XSL : ajouter du texte apres un element
Reply-To: Stephane.Legrand@bigfoot.com
Message-ID: <slrn9d72nn.hdq.Stephane.Legrand@sequoia.mondomaineamoi.megalo>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: slrn/0.9.6.3 (FreeBSD)
Lines: 62
Date: Tue, 10 Apr 2001 22:37:30 GMT
NNTP-Posting-Host: 213.228.43.206
X-Complaints-To: abuse@proxad.net
X-Trace: nnrp1.proxad.net 986942250 213.228.43.206 (Wed, 11 Apr 2001 00:37:30 CEST)
NNTP-Posting-Date: Wed, 11 Apr 2001 00:37:30 CEST
Organization: Guest of ProXad - France