xsl:if question

djohnston

Active member
Joined
Jun 1, 2006
Messages
33
Programming Experience
Beginner
I just need for a check on wether or not the node has any type of value numeric or alphabetic or alphanumeric. Doesn't really matter what value.

I tried something like this
<xsl:if "@asOF = true">
<value of selct = asOF>
</xsl:if>

With all the formatters im sure if you understand the question you understand what I mean. I just need a check for data so it knows to display it or not to.

Help appreciated alot.
Thanks.
 
try:
HTML:
<xsl:if test="@asOF != "">
<xsl:value-of select="@asOF" /> 
</xsl:if>
 
A little spelling error there, sorry about that, change the single double-quote in Xpath expression into double single-quotes. Yes, really :) You see, the test is to check if attribute asOF is not an empty string, and to use quotes within quoted expression you have at first level go from double-quote to single-quote as quotation marks. (At next level as usually done with composing Xml strings in Javscripts you have to escape the quotes with backslash \) Again:
HTML:
<xsl:if test="@asOF != ''">
<xsl:value-of select="@asOF" /> 
</xsl:if>
 
Thanks alot

Its not a database value so i just omitted the @
But other then that thanks alot The report will look alot more professional now that i can ommit fields.

Well I'm thinking about maybe making some forums of my own,
its probably a really good way to learn.

If not maybe i can get admin to one of these forms i post on once i get good enough.

I mean i know starting i can just use msdn to answer questions but im only looking at about my 3rd week of programming.
 
djohnston said:
Its not a database value so i just omitted the @
FYI, in XPath the @ signifies an attribute of a Xml node.
 
Ok thats cool

Ohh lol ya I'm actually just displaying it with a gui interface.

So I'm not really using xpath.

I think lol.

FYI: Only on my third week of programming lol.
 
funny, the expression in the 'test' attribute of xsl:if element is an XPath expression. So when you're doing asOF != '' you're doing XPath. There are good Xml, Xsl(t), Xpath tutorials at the W3 Schools http://www.w3schools.com/
 
Thanks

Ya i was just playing around.
I am still a programming newbie but I will continue to get better at it.

Im thinking about this weeked and I am probably going to create a tetris like game then move up from there.

Thanks for the help.
 
Back
Top