This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > August 2005 > How to make Or in XSL





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to make Or in XSL
Mystique

2005-08-14, 7:42 pm

Hello
I am working on an XSLT file that converts my XML into an HTML file. I don't
know how to make an OR in XSL. Can somebody tell me how to do this?
What I need is something like this:

if X or Y then
......
......

Thanks In Advance
Mystique


Oleg Tkachenko [MVP]

2005-08-14, 7:42 pm

Mystique wrote:

> I am working on an XSLT file that converts my XML into an HTML file. I don't
> know how to make an OR in XSL. Can somebody tell me how to do this?
> What I need is something like this:
>
> if X or Y then


<xsl:if test="X or Y">
<!-- "then" body goes here -->
</xsl:if>

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net
http://blog.tkachenko.com
Joe Fawcett

2005-08-14, 7:42 pm

"Mystique" <misic@softhome.net> wrote in message
news:OVVN52MoFHA.3608@TK2MSFTNGP15.phx.gbl...
> Hello
> I am working on an XSLT file that converts my XML into an HTML file. I don't
> know how to make an OR in XSL. Can somebody tell me how to do this?
> What I need is something like this:
>
> if X or Y then
> .....
> .....
>
> Thanks In Advance
> Mystique
>
>

You're there...
<xsl:if test="elementA = 'a' or elementB = 'b'">
<!-- do something -->
</xsl:if>
Test is true if <elementA> contains "a" or <elementB> contains "b". You have to
repeat the LHS, even if it's the same element:

WRONG:
<xsl:if test="elementA = 'a' or 'b'">

Right

<xsl:if test="elementA = 'a' or elementA = 'b'">

http://msdn.microsoft.com/library/d....asp?frame=true


--

Joe (MVP - XML)

https://mvp.support.microsoft.com/p...E8-8741D22D17A5



Mystique

2005-08-14, 7:42 pm

Thanks Joe
Does the same go for 'and'? can I write this:

<xsl:if test="elementA = 'a' and elementB = 'b'">

Regards,
Mystique


"Joe Fawcett" <joefawcett@newsgroups.nospam> wrote in message
news:OnNdp9MoFHA.420@TK2MSFTNGP09.phx.gbl...
> "Mystique" <misic@softhome.net> wrote in message
> news:OVVN52MoFHA.3608@TK2MSFTNGP15.phx.gbl...
> You're there...
> <xsl:if test="elementA = 'a' or elementB = 'b'">
> <!-- do something -->
> </xsl:if>
> Test is true if <elementA> contains "a" or <elementB> contains "b". You
> have to repeat the LHS, even if it's the same element:
>
> WRONG:
> <xsl:if test="elementA = 'a' or 'b'">
>
> Right
>
> <xsl:if test="elementA = 'a' or elementA = 'b'">
>
> http://msdn.microsoft.com/library/d....asp?frame=true
>
>
> --
>
> Joe (MVP - XML)
>
> https://mvp.support.microsoft.com/p...E8-8741D22D17A5
>
>
>



Mystique

2005-08-15, 7:24 am

Does the same go for 'and'? can I write this:

<xsl:if test="elementA = 'a' and elementB = 'b'">

Regards,
Mystique

"Oleg Tkachenko [MVP]" <some@body.com> wrote in message
news:uOALd9MoFHA.320@TK2MSFTNGP09.phx.gbl...
> Mystique wrote:
>
don't[color=darkred]
>
> <xsl:if test="X or Y">
> <!-- "then" body goes here -->
> </xsl:if>
>
> --
> Oleg Tkachenko [XML MVP, MCAD]
> http://www.xmllab.net
> http://blog.tkachenko.com



Oleg Tkachenko [MVP]

2005-08-15, 7:24 am

Mystique wrote:
> Does the same go for 'and'? can I write this:
>
> <xsl:if test="elementA = 'a' and elementB = 'b'">


Sure.

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net
http://blog.tkachenko.com
Mystique

2005-08-15, 7:24 am

OK :-)
Thanks Oleg

"Oleg Tkachenko [MVP]" <some@body.com> wrote in message
news:#jQM#AXoFHA.3960@TK2MSFTNGP12.phx.gbl...
> Mystique wrote:
>
> Sure.
>
> --
> Oleg Tkachenko [XML MVP, MCAD]
> http://www.xmllab.net
> http://blog.tkachenko.com



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews