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

testing for presence of a variable

Subject: testing for presence of a variable
From: Bruce D'Arcus <bdarcus@xxxxxxxxx>
Date: Fri, 6 May 2005 18:59:30 -0400
xml test for variable presence
Is there a way I can condition a variable on the presence (or absence) of another variable?

I have a crucial global variable in my stylesheets which goes through a document a collects all the citation references. This works well when I have self-contained documents. However, in the case of the manuscript I just finished, I needed to first include the individual chapters into a variable, and then run the stylesheets on that.

To get it to work thus required adding the $chapters variable to the path.

<xsl:variable name="citerefs" select="($chapters)//db:biblioref/@linkend"/>

If I then run the stylesheets on a standalone document that doesn't include this variable, it fails.

So I'm wanting to do something like this:

<xsl:variable name="root-node" select="if ($chapters) then ($chapters) else ()"/>
<xsl:variable name="citerefs" select="($root-node)//db:biblioref/@linkend"/>


... but get an error about the missing $chapters.

Any suggestions?

Bruce

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.