• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

If not null - need help with rule.....

 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two variables declared var1 and var2.
I am trying to use a choice element and select the value-of var2 if value-of var1 is null.
Haven't had any success. Any ideas are appreciated...
Thanks.

- madhav


[Map edited code to reduce page width]
[ November 05, 2002: Message edited by: Mapraputa Is ]
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) You'd better post the entire code, instead of code snippet
2) Remember, xsl:variable select="something" is actually constant. You cannot change it.
3) xsl aram select="something" is default value, it can be replaced by real value.
I don't know what you want to do.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with the const thingy. I am not changing the values of var1 and var2. In programming language terms:

Give that var1 and var2 are declared as xsl:variables with appropriate "select" stmts to valid XPath locations, how should I write above rule in XSL......
Thanks.
- madhav.........try teaching XSL to a programmer!!!
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I found that there is a string-length function and then what........
string-length('$var1') doesn't seem to work.....
Any help please.......
- madhav
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your answer, Sir!

- Roseanne.........try teaching XSL to a programmer!!!
[ November 05, 2002: Message edited by: Roseanne Zhang ]
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[ November 05, 2002: Message edited by: Ron Newman ]
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What problem are you having with string-length() ?
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What problem are you having with string-length() ?
When I declared xsl:variable, the test never worked. I changed it to xsl:param and my changes seem to work.
Now I am attempting to print the value of the lenght......
<xsl:if test="string-length(normalize-space($param1)) > 1">
xyz = string(string-length(normalize-space($param1)))
</xsl:if>
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The function won't be found or evaluated in plain text.
It works only in an XSL tag. You need to change your code to:

[ November 05, 2002: Message edited by: Ron Newman ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
aha!!!.
Thanks.
- madhav
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ron
How did you get "otherwise" posted correctly? Did you escape "o" or column? Just curious.
Let me try

Roseanne
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, it works!!!
I used &#58; to escape ":". Excellent!!!
I'll not fix the other posts by me. Other people will learn the lesson by comparison.
[ November 05, 2002: Message edited by: Roseanne Zhang ]
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I checked off "Disable smilies in this post" under "Options".
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But if you still want to use smiles somewhere in your post besides xsl tags :roll: you have to resort to Roseanne's trick.
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic