[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Adding Variables

Subject: Re: Adding Variables
From: Deirdre Saoirse Moen <deirdre@xxxxxxxxxxx>
Date: Mon, 16 Aug 2004 13:59:22 -0700
adding variables
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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.