Re: Multiple expressions in if conditons
There is hardly ever a reason to use that statement. In all-but-one scenario's you can replace it with:
..before.. <xsl:apply-templates select="//*" /> ..after..
<xsl:template match="*" > ...code here .. </xsl:template>
Of course, depending on context node, //* may not be desirable at all (it is a very expensive instruction that should be avoided). Every beginner book or tutorial on XSLT should point you to how to use matching templates.
<xsl:variable name="code" select="name()" />
Make sure you understand the differences between using name() and local-name(). This involves understanding namespaces. It is a tricky subject, but once you get the hang of it, it will work to your advantages. Again, I recommend any good text book or online tutorial.
<xsl:variable name="value" select="." /> <xsl:if test= "$code != ('state_results') or ('game_results')">
This is considered 'evil' code (apart from the obvious error). You can do this, of course, but it is far from extensible and hardly ever necessary. See above. Instead, write this for each node you want to match:
<xsl:template match="not(state_results | game_results)" > ... your code ... </xsl:template>
You can, by joining with 'or'. But, as with any computer language, you must complete your expression.
$code != 'state_results' or $code != 'game_results'
which, by the way, will likely not do what you want: it is always true.
Good luck with learning XSLT. Please read a tutorial, it will save you tons of time. XSLT is not a language like you are likely to be accustomed with, and a tutorial should help you putting on the different pair of glasses needed to work productively and without too many hair-tearing situations ;)
Cheers, -- Abel Braaksma http://www.nuntia.nl
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format