This XSLT code is a template function that accept @ExpiryDate as parameter whcih is always blank. so if my "if conditions" are right then it should ago in at least 1 if condition.
I have updated the XSLT as well.
Please mark it answer if it helps you.
Visit My Blog
shafaqat309
Member
433 Points
180 Posts
XSLT string comparison
Jan 09, 2013 02:16 AM|LINK
Hi
I have follwoing code in XSLT file, i am trying to use if condition but its not working, please help.
it does'nt print anything in if condition, if i try to print $showNews, it returns false.
Am i using the right way of string comparison?
Visit My Blog
kavita_khand...
Star
9767 Points
1931 Posts
Re: XSLT string comparison
Jan 10, 2013 04:51 AM|LINK
What is your input XML?
I would love to change the world, but they wont give me the source code.
shafaqat309
Member
433 Points
180 Posts
Re: XSLT string comparison
Jan 10, 2013 08:23 AM|LINK
I am using this XSLT code in sharepoint, can't put xml here.
Visit My Blog
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: XSLT string comparison
Jan 11, 2013 05:07 AM|LINK
Hi,
If you don't show us your full xml contents, I'm afraid we cannot continue to help you more.
shafaqat309
Member
433 Points
180 Posts
Re: XSLT string comparison
Jan 12, 2013 03:04 AM|LINK
Am i using the right way of if condition in XSLT?
Visit My Blog
kavita_khand...
Star
9767 Points
1931 Posts
Re: XSLT string comparison
Jan 12, 2013 06:16 AM|LINK
Put up a sample short xml , with different node names, but hierarcy of the xml element should be same. (You can put dummy values in the xml)
I would love to change the world, but they wont give me the source code.
shafaqat309
Member
433 Points
180 Posts
Re: XSLT string comparison
Jan 12, 2013 08:20 AM|LINK
This XSLT code is a template function that accept @ExpiryDate as parameter whcih is always blank. so if my "if conditions" are right then it should ago in at least 1 if condition.
I have updated the XSLT as well.
Visit My Blog
dahla
Participant
1816 Points
369 Posts
Re: XSLT string comparison
Jan 12, 2013 09:14 PM|LINK
You are probably facing issues with linespaces. Try writing
<![CDATA[false]]>
then you can use your string comparison.
Otherwise you could also just write
<xsl:variable name="showNews" select="ddwrt:FormatDateTime(@ExpiryDate, 1033, 'dd MMMM yyyy') =''/>
And then you can write <xsl:if test="$showNews">
shafaqat309
Member
433 Points
180 Posts
Re: XSLT string comparison
Jan 14, 2013 10:12 AM|LINK
thanx.
Visit My Blog