Hi Mark,
On Wed, 31 Aug, 2022, 06:57 Mark Giffin m1879@xxxxxxxxxxxxx, <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> XSLT 2.0, Saxon processor.
>
>
>
> What's a good way to check if a variable has a value? I want to print
> something if a variable has a value, and not print it if it is not given a
> value. This must be extremely simple but I don't see it.
>
I think, we can simply compare XSLT 2.0+ variable's value with an empty
sequence.
i.e somthing like below,
<xsl:if test="not(deep-equals($var, ()))">
<xsl:copy-of select="$var"/>
</xsl:if>
(this will output the contents of variable to XSLT result tree, which the
XSLT serializer could serialize to an XML fragment instance for example)
or,
<xsl:if test="not(deep-equals($var, ()))">
<xsl: value-of select="diagnostic message"/>
</xsl:if>
--
Regards,
Mukul Gandhi
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3430162> (by
> email <>)
|