RE: [xsl] if/else xsl ?

Subject: RE: [xsl] if/else xsl ?
From: Rod Humphris - FLPTN <rod.humphris@xxxxxxxxxxxxxx>
Date: Fri, 2 Jul 2004 11:35:40 +0100
You can believe your error message. This is not well formed xml (an xslt has
to be xml):

<xsl:for-each select="*">
<xsl:value-of select="@desc" /> : </td>

If you save your xslt with an .xml extension and open it with Internet
Explorer it will point to the problem for you.

Cheers

Rod

-----Original Message-----
From: Pierre [mailto:pierre@xxxxxxxxxxxxx]
Sent: 02 July 2004 11:30
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] if/else xsl ?


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="{@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@xxxxxxxxxxxxx] 
Envoyé : vendredi 2 juillet 2004 11:12
À : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxx>
--+--




--+------------------------------------------------------------------
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@xxxxxxxxxxxxxxxxxxxxxx>
--+--


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________


_________________________________________________________________________
 
Any  opinions  expressed in  this email  are those of the individual  and
not necessarily  the Company.  Unless  expressly  stated to the contrary,
this email is not intended to give  rise to a new, or affect an existing,
contractual or other legal relationship.
 
This email  and  any  files  transmitted  with it, including replies  and
forwarded copies which  may contain alterations) subsequently transmitted
from the Company, are confidential and solely for the use of the intended
recipient.  The unauthorised use, disclosure or copying of this email, or
any other information contained  or attached, is prohibited and could, in
certain circumstances, be a criminal offence.
 
If you have received this email in error please notify the sender as soon
as possible.
 
This footnote  also confirms that  this email message  has been swept for
the presence of computer viruses.
 
www.focusdiy.co.uk
_________________________________________________________________________


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Current Thread