This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xsl:if syntax problem


Joerg,

Found a solution to our problem. We moved the <xsl:if> further down in the
xsl file after where some <xsl:attribute> declarations were. Also, after
getting the <xsl:if> statement to work we changed to a <xsl:choose>
statement as follows:

   <xsl:choose>
      <xsl:when test="onClick[. !=''] ">

The important part being the "onClick[. !=''] " .....

Brian.

-----Original Message-----
From: Joerg Heinicke [mailto:joerg.heinicke@gmx.de]
Sent: 20 March 2002 14:38
To: Brian Moynihan
Subject: Re: [xsl] xsl:if syntax problem


Hmm, really strange. It should work. But here a complete example:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="entity">
     <xsl:text>entity </xsl:text>
     <xsl:value-of select="@id"/>
     <xsl:text>: </xsl:text>
     <xsl:if test="normalize-space(onClick)">
         <xsl:text>onClick exists and it is not empty</xsl:text>
     </xsl:if>
     <xsl:if test="not(normalize-space(onClick))">
         <xsl:text>onClick does not exist or it is empty</xsl:text>
     </xsl:if>
</xsl:template>

<xsl:template match="text()"/>

</xsl:stylesheet>

This stylesheet gives you a list of all <entity>'s with the information, 
whether there is onClick or not. Add linebreaks or <br/> if you need it.

Of course the two <xsl:if>'s can be replaced by <xsl:choose>, <xsl:when> 
and <xsl:otherwise>, but it should only show the right way.

Regards,

Joerg

Brian Moynihan wrote:
> Hi Joerg,
> 
> Thanks for your reply ... unfortunately it doesn't solve our problem.
> 
> We realise that we are testing the xsl:if statement both ways, but this is
> in order to get the syntax of the if statement correct.
> 
> We have tried your suggestions but to no avail. It looks to us like the
XSL
> is not seeing the <onClick> tag, although later on in our XSL we are able
to
> retrieve the value associated with the <onClick> tag.
> 
> If you have any more suggestions can you please reply. Ideally, could you
> forward on an example of a working xsl:if statement.
> 
> Thanks for your time,
> Brian.

-- 

System Development
VIRBUS AG
Fon  +49(0)341-979-7411
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


**********************************************************************
Privileged, confidential and/or copyright information may be contained
in this e-mail. This e-mail is for the use only of the intended
addressee. If you are not the intended addressee, or the person
responsible for delivering it to the intended addressee, you may not
copy, forward, disclose or otherwise use it or any part of it in any
way whatsoever. To do so is prohibited and may be unlawful.

If you receive this e-mail by mistake please advise the sender
immediately by using the reply facility in your e-mail software.

Orygen (Ireland) Limited may monitor the content of e-mails sent and
received via its network for the purposes of ensuring compliance with
its policies and procedures.

This message is subject to and does not create or vary any contractual
relationship between Orygen (Ireland) Limited and you.
**********************************************************************



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]