Subject: Re: Is a variable referencing a node
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 29 Sep 2008 16:33:15 +0100
|
Basically, I want a template that will output the text of a node for an
arbitrary XPath if that node exists. If the node doesn't exist, I want
it to produce "--".
in xslt 2
<xsl:value-of select="(/path/to/single/node,'--')[1]"/>
in xslt 1
<xsl:variable name="n" select="/path/to/single/node"/>
<xsl:value-of select="$n"/>
<xsl:if test="not($n)">--</xsl:if>
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
| Current Thread |
|
David Frey - 29 Sep 2008 15:36:21 -0000
|
|