xsl-list
[Top] [All Lists]

testing for presence of a variable

2005-05-06 15:59:30

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>