On Aug 16, 2004, at 6:20 AM, Michael Kay wrote:
What I've never quite understood is how to wrap this into a
conditional.
[big snip]
The problem with this code is that you get a copy of the nodes in
somevalue1.
Ouch. Not what I wanted.
If you want the variable to hold references to the actual nodes,
a conditional assignment is difficult to achieve in XSLT 1.0. It
becomes
easy in 2.0:
<xsl:variable name="n" select="if (COND) then //a/b/c else 20"/>
OK, that works for the single if/else case. I need to ponder whether or
not I need a more complex case.
In 1.0 you can sometimes solve the problem with
<xsl:variable name="n" select="//a/b/c[COND] | //a/b/d[not(COND)]"/>
That *may* work for my application. I'm not to the point where I'm
implementing, but it's entirely possible that I could make it work.
--
_Deirdre web: http://deirdre.net blog: http://deirdre.org/blog/
Story "A Sword Called Rhonda" in anthology _Turn the Other Chick_
Now available for preorder:
http://www.amazon.com/exec/obidos/ASIN/0743488571/deirdrswebpages/