From: LENTZ Marc (Marc.LENTZ@ctrceal.caisse-epargne.fr)
Date: 27/10/2000 - 10:16
Salut à tous ...
Voilà, je débute sous XML ...
J'ai un fichier XML recipe.xml (une recette, avec son DTD) ....
Auquel est associé une feuille de style XSL (xslparse.xsl) ... pour
transformer l'XML en HTML ...
(ces deux fichiers sont listés en base de ce mail)
Et lorsque je browse mon fichier recipe.xml, avec IE5 ...
Je ne vois pas grand chose ...
Je vois la structure HTML (défini dans l'XSL), mais je ne vois pas les
données ...
Je pense que c'est tout bête ... mais j'ai déjà passé + de 5h dessus ...
rien y fait ...
Et je pense que l'un de vous, rien qu'en voyant les entêtes de mes fichiers
trouvera du premier coup d'oeil ...
Le problème que j'ai ...
D'avance merci ...
----------------------------------------------------------------------------
-------------
Recipe.xml
----------------------------------------------------------------------------
-------------
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xslparse.xsl"?>
<!DOCTYPE Recipe [
<!ELEMENT Recipe (Name, Description?, Ingredients?, Instructions?)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Description (#PCDATA)>
<!ELEMENT Ingredients (Ingredient)*>
<!ELEMENT Ingredient (Qty, Item)>
<!ELEMENT Qty (#PCDATA)>
<!ATTLIST Qty unit CDATA #REQUIRED>
<!ELEMENT Item (#PCDATA)>
<!ATTLIST Item optional CDATA "0"
isVegetarian CDATA "true">
<!ELEMENT Instructions (Step)+>
<!ELEMENT Step (#PCDATA)>
]>
<Recipe>
<Name>Lime Jello Marshmallow Cottage Cheese Surprise</Name>
<Description>My grandma's favorite (may she rest in peace).</Description>
<Ingredients>
<Ingredient>
<Qty unit="box">1</Qty>
<Item>lime gelatin</Item>
</Ingredient>
<Ingredient>
<Qty unit="g">500</Qty>
<Item>multicolored tiny marshmallows</Item>
</Ingredient>
<Ingredient>
<Qty unit="ml">500</Qty>
<Item>Cottage cheese</Item>
</Ingredient>
<Ingredient>
<Qty unit="dash">1</Qty>
<Item optional="1">Tabasco sauce</Item>
</Ingredient>
</Ingredients>
<Instructions>
<Step>Prepare lime according to package instructions</Step>
<Step>Prepare gelatin according to package instructions</Step>
<Step>And Mix ALL !</Step>
<!-- And so on... -->
</Instructions>
</Recipe>
----------------------------------------------------------------------------
-------------
----------------------------------------------------------------------------
-------------
xslparse.xsl
----------------------------------------------------------------------------
-------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/XSL/Transform/1.0'
xmlns:fo='http://www.w3.org/XSL/Format/1.0'
result-ns=''>
<xsl:template match="Recipe">
<HTML>
<HEAD>
<TITLE>
<xsl:value-of select="Name"/>
</TITLE>
</HEAD>
<BODY>
<H3>
<xsl:value-of select="Name"/>
</H3>
<STRONG>
<xsl:value-of select="Description"/>
</STRONG>
<xsl:apply-templates/>
</BODY>
</HTML>
</xsl:template>
<!-- Format ingredients -->
<xsl:template match="Ingredients">
<H4>Ingredients</H4>
<TABLE BORDER="1">
<TR BGCOLOR="#308030"><TH>Qty</TH><TH>Units</TH><TH>Item</TH></TR>
<xsl:for-each select="Ingredient">
<TR>
<!-- handle empty Qty elements separately -->
<xsl:if test='Qty[not(.="")]' >
<TD><xsl:value-of select="Qty"/></TD>
</xsl:if>
<xsl:if test='Qty[.=""]' >
<TD BGCOLOR="#404040"> </TD>
</xsl:if>
<TD><xsl:value-of select="Qty/@unit"/></TD>
<TD><xsl:value-of select="Item"/>
<xsl:if test='Item/@optional="1"'>
<SPAN> -- <em><STRONG>optional</STRONG></em></SPAN>
</xsl:if>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
<!-- Format instructions -->
<xsl:template match="Instructions">
<H4>Instructions</H4>
<OL>
<xsl:apply-templates select="Step"/>
</OL>
</xsl:template>
<xsl:template match="Step">
<LI><xsl:value-of select="."/></LI>
</xsl:template>
<!-- ignore all not matched -->
<xsl:template match="*"/>
</xsl:stylesheet>
----------------------------------------------------------------------------
-------------
--
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
|