🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Parser et r��crire � l'identique II (le retour)

#8293
From: Aurelien DEHAY
Date: Mon, 12 Nov 2001 10:25
80 lines
3533 bytes
"Pascal Cescon" <pascal.cescon@cityneo.com> writes:

> Bonjour,
> 
> Dans une question pr�c�dente j'obetnais une excellente r�ponce de Alain qui
> me conduisi � �crire le code suivant :

[...]

Moi j'ai un petit bout de code qui fait les choses suivantes:

1- selon un param�tre, g�n�re un des 2 processing-instruction (pour
l'html ou le pdf)

2- applique un mod�le pour un xml dont le contenu est dans un autre
xml

3- recopie tout le reste

La v'l�:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:include href="relations.xsl"/>
    
  <xsl:param name="format">html</xsl:param>
  <xsl:preserve-space elements="*"/>
  
  <xsl:template match="document">
    <xsl:choose>
      <xsl:when test="$format='pdf'">
	<xsl:processing-instruction name="cocoon-format">type="text/xslfo"</xsl:processing-instruction>
	<xsl:processing-instruction name="cocoon-process">type="xslt"</xsl:processing-instruction>
	<xsl:processing-instruction name="cocoon-process">type="xinclude"</xsl:processing-instruction>
	<xsl:processing-instruction name="xml-stylesheet">version="1.0" href="/styles/xsl/document-pdf.xsl" type="text/xsl"</xsl:processing-instruction>
      </xsl:when>
      <xsl:when test="$format='html'">
	<xsl:processing-instruction name="cocoon-process">type="xslt"</xsl:processing-instruction>
	<xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
	<xsl:processing-instruction name="xml-stylesheet">version="1.0" href="/styles/xsl/document-html.xsl" type="text/xsl"</xsl:processing-instruction>
      </xsl:when>
    </xsl:choose>
    
    <xsl:copy>
      <xsl:apply-templates select="@*|*|text()"/>
    </xsl:copy>
    
    </xsl:template>

    <xsl:template match="relations" priority="1">
      <xsl:apply-templates select="document('/usr/local/var/cvs/arbo.xml')/liens">
	<xsl:with-param name="type" select="@type"/>
	<xsl:with-param name="p" select="@p"/>
	<xsl:with-param name="m" select="@m"/>
	<xsl:with-param name="a" select="@a"/>
      </xsl:apply-templates>
    </xsl:template>
    
    <xsl:template match="@*|*|text()" priority="-1">
      <xsl:copy>
	<xsl:apply-templates select="@*|*|text()"/>
      </xsl:copy>
    </xsl:template>


</xsl:stylesheet>


A mon avis, il te manque un @* quelquepart.

> 
> Merci
> 
> Pascal
> 
> 

-- 
Aur�lien DEHAY
Technical Details
Message-ID: <m3u1w05lqt.fsf@win000002.wanadoo.fr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!193.251.151.101!opentransit.net!wanadoo.fr!not-for-mail
References: <9so7l0$ml8$1@wanadoo.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII
X-Google-Thread: 114f60,ae7792717d1891f9
X-Google-Attributes: gid114f60,public
X-Google-ArrivalTime: 2001-11-12 02:26:21 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!193.251.151.101!opentransit.net!wanadoo.fr!not-for-mail
From: Aurelien DEHAY <aurelien.dehay@wanadoo.com>
Newsgroups: fr.comp.text.xml
Subject: Re: Parser et r��crire � l'identique II (le retour)
Date: 12 Nov 2001 11:25:46 +0100
Organization: Wanadoo, l'internet avec France Telecom
Lines: 80
Message-ID: <m3u1w05lqt.fsf@win000002.wanadoo.fr>
References: <9so7l0$ml8$1@wanadoo.fr>
NNTP-Posting-Host: alim-priv1.wanadoo.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: wanadoo.fr 1005560780 17645 192.168.225.242 (12 Nov 2001 10:26:20 GMT)
X-Complaints-To: abuse@wanadoo.fr
NNTP-Posting-Date: 12 Nov 2001 10:26:20 GMT
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1
X-Forwarded: by - (DeleGate/7.1.2)