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

Each value in an XPath array is a sequence of elements

Subject: Each value in an XPath array is a sequence of elements ... how to access a particular element in a particular array value?
From: "Costello, Roger L. costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Jun 2019 14:25:50 -0000
 Each value in an XPath array is a sequence of elements
Hi Folks,

This is an extension to a question that I had last week ...

Recall that I want to group the <row> elements in the following XML. Each
group should consist of those <row> elements that have the same ARPT__IDENT,
TRM__IDENT values.


That XML consists of two groups. Each group has two <row> elements.

Martin provided a great XPath 3.1 expression for doing the grouping:

<xsl:variable name="groups" as="array(element(row))*" select="
    let $keys :=
        distinct-values($rows/concat(ARPT__IDENT, '|', TRM__IDENT))
        for $i in $keys
            array {$rows[$i = concat(ARPT__IDENT, '|', TRM__IDENT)] }

In the following, I select the first group:

<xsl:variable name="first-group" select="$groups[1]" />

Next, I want to select the <row> element in the first group that has Foo as
the value of the <Data> element. I thought that this would be the appropriate
XPath expression:

<xsl:variable name="Foo-row-first-group" select="$first-group/row[Data eq

Apparently it is not the appropriate XPath expression, because I get this
error message:

	Axis step child::element(Q{}row) cannot
 	be used here: the context item is not a node

What is the appropriate XPath expression, please?


Current Thread


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.
First Name
Last Name
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.