xsl-list
[Top] [All Lists]

RE: if/else xsl ?

2004-07-02 03:29:51
Mmmm i don't see what's wrong here 
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" />
<xsl:template match="/">
<xsl:for-each select="formulaire/FRMFAT04001">
<table><form action="" method="post" name="form1">
<xsl:for-each select="*">
<xsl:value-of select="@desc" /> : </td><td>
<tr><td align="right">
<xsl:choose>
        <xsl:when test="@desc=Pays">
        do another thing here...
        </xsl:when>
        <xsl:otherwise>
                <xsl:element name="{(_at_)type}">
                <xsl:attribute name="size">
                <xsl:value-of select="@size" />
                </xsl:attribute>
                <xsl:attribute name="maxlength">
                <xsl:value-of select="@size" />
                </xsl:attribute>
                <xsl:attribute name="value">
                <xsl:value-of select="text()" />
                </xsl:attribute>
                <xsl:attribute name="name">
                <xsl:value-of select="@name" />
                </xsl:attribute>
                </xsl:element>
        </xsl:otherwise>
</xsl:choose>
</td></tr>
</xsl:for-each>
<tr><td align="center" colspan="2"><input type="Submit" name="Submit"
value="Envoyer"/><input type="Reset" name="Reset" /></td></tr>
</form></table>
</xsl:for-each>
</xsl:template>
 </xsl:stylesheet>

This is my xml

<?xml version="1.0" encoding="utf-8" ?>
<formulaire>
        <FRMFAT04001>
                <c001 type="input" desc="Societe" size="32"
name="001"></c001> 
                <c002 type="input" desc="Adresse" size="32"
name="002"></c002> 
                <c003 type="input" desc="Complement" size="32"
name="003"></c003> 
                <c004 type="input" desc="Code postal" size="15"
name="004"></c004> 
                <c005 type="input" desc="Ville" size="32" name="005"></c005>
                <c006 type="input" desc="Comte/Cedex" size="32"
name="006"></c006>
                <c007 type="input" desc="Pays" size="32" name="007"></c007> 
        </FRMFAT04001>
        <PAYS>
                <france iso="fr" option="France" />
                <allemagne iso="de" option="Allemagne" />
        </PAYS>
</formulaire>

This is my error 

Warning: Sablotron error on line 8: XML parser error 7: mismatched tag

Please help with some explications to understand where I'm wrong and why ?
Thx to all

Pierre 

-----Message d'origine-----
De : Michael Müller-Hillebrand [mailto:info(_at_)cap-studio(_dot_)de] 
Envoyé : vendredi 2 juillet 2004 11:12
À : xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Objet : Re: [xsl] if/else xsl ?

It is not the shortest possibility, but that's the way XSL is doing this:

<xsl:choose>
  <xsl:when test="...">
    if stuff
  </xsl:when>
  <xsl:otherwise>
    else stuff
  </xsl:otherwise>
</xsl:choose>

- Michael
On 02.07.2004 (11:58 Uhr +0200), Pierre wrote:

Hi guy i search some docs about if - else in xsl but can't fin it
Any idea plz ?
i have this and I wanna when @desc="pays" do other thing how can I do it ?
thx for help

Pierre

-- 
________________________________________________________________
Michael Müller-Hillebrand, Dipl.-Ing.    <http://cap-studio.de/>
    FrameMaker, FrameScript, XML/XSL,... Publishing-Lösungen

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>