[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XPath expression which expresses sequence-extended

Subject: Re: XPath expression which expresses sequence-extended = (sequence, item)
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Nov 2017 21:59:29 -0000
Re:  XPath expression which expresses sequence-extended
On 21 November 2017 at 13:08, Costello, Roger L. costello@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.