You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Calabrese, Jason" <JC...@exchange.SanDiegoCA.NCR.COM> on 2000/11/07 17:42:07 UTC

xsl:value-of default

I'm not sure if this is the correct place to ask, but I don't know where
else to go.

Is there anyway to have a default value for the xsl:value-of function, that
would be used if the XPath expression isn't able to locate an element or
attribute?

Re: xsl:value-of default

Posted by Gary L Peskin <ga...@firstech.com>.
"Calabrese, Jason" wrote:
> I'm not sure if this is the correct place to ask, but I don't know where
> else to go.

For straight XSL questions like these, you'll probably get faster
response from XSL-List
(http://www.mulberrytech.com/xsl/xsl-list/index.html).

> Is there anyway to have a default value for the xsl:value-of function, that
> would be used if the XPath expression isn't able to locate an element or
> attribute?

Will this do what you want:

  <xsl:choose>
    <xsl:when test="your-XPath-expression">
      <xsl:value-of select="your-XPath-expression"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text>Default value</xsl:text>
    </xsl:otherwise>
  </xsl:choose>

Gary