On 21 November 2017 at 13:08, Costello, Roger L. costello(_at_)mitre(_dot_)org
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
David Carlisle wrote:
why?
What I mean is that this expression:
$sequence-extended/item = ($sequence/item, $item)
returns false when $sequence is empty (and the other variables have the
values I described).
/Roger
to give a reply of more than one word, the xpath you suggest returns
true not false on both the examples you give:
$ saxon9 -it:test seq1.xsl
<?xml version="1.0" encoding="UTF-8"?>
test1: true
test2: true
where seq1.xsl is
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="test">
<!--
Suppose that $sequence-extended has this value:
-->
<xsl:variable name="sequence-extended" as="element()">
<sequence>
<item>A</item>
<item>B</item>
</sequence>
</xsl:variable>
<!--
And $sequence has this value:
-->
<xsl:variable name="sequence" as="element()">
<sequence>
<item>A</item>
</sequence>
</xsl:variable>
<!--
And $item has this value:
-->
<xsl:variable name="item" as="element()">
<item>B</item>
</xsl:variable>
test1: <xsl:value-of select="$sequence-extended/item =
($sequence/item, $item)"/>
<!--
But, the XPath expression fails when $sequence is empty:
-->
<xsl:variable name="sequence" as="element()">
<sequence/>
</xsl:variable>
<!--
And $sequence-extended has a single item:
-->
<xsl:variable name="sequence-extended" as="element()">
<sequence>
<item>A</item>
</sequence>
</xsl:variable>
<!--
And $item is:
-->
<xsl:variable name="item" as="element()">
<item>A</item>
</xsl:variable>
test2: <xsl:value-of select="$sequence-extended/item =
($sequence/item, $item)"/>
</xsl:template>
</xsl:stylesheet>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--