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

Re: XTTE1100: A sequence of more than one item is not

Subject: Re: XTTE1100: A sequence of more than one item is not allowed as the @group-adjacent attribute
From: Ihe Onwuka <ihe.onwuka@xxxxxxxxx>
Date: Mon, 13 May 2013 02:49:52 +0100
Re:  XTTE1100: A sequence of more than one item is not
On Mon, May 13, 2013 at 2:20 AM, G. Ken Holman
<gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
> At 2013-05-13 02:08 +0100, Ihe Onwuka wrote:
>>
>> On Mon, May 13, 2013 at 1:55 AM, G. Ken Holman
>> <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
>> > At 2013-05-13 01:50 +0100, Ihe Onwuka wrote:
>> >>
>> >> I am getting the above error on the following line of code
>> >>
>> >> <xsl:for-each-group select="*" group-adjacent="data(
>> >> descendant::*/local-name())">
>> >>
>> >> I originally tried it without wrapping it in the data function and
>> >> have also tried casting it to string (where I get a different but
>> >> similar answer).
>> >>
>> >> I'm sure there is a simple answer out there.
>> >
>> >
>> > Yes, both the data() function the group-adjacent= attribute are each
>> > expecting a singleton evaluation and you are supplying a sequence
>> > expression
>> > that returns more than a singleton value.
>> >
>> > The expression is evaluated from the context of the member of the
>> > population
>> > being grouped.  The expression descendant::*/local-name() returns a
>> > sequence
>> > of strings being the local name of all of the descendant elements of
>> > each
>> > element of the population.  The error message is quite explicit in what
>> > is
>> > wrong.
>> >
>> > What is it you are trying to do
>>
>> I am trying to group the children of each element by the  local name
>> of all of the descendant elements of each child.
>
>
> I can read that from your expression, but it doesn't make sense to me on a
> number of levels.
>
> First, your sentence implies you should be using group= instead of
> group-adjacent= ... do you want *all* elements that are "the same" in one
> group, or do you want them split up into groups of elements that are
> adjacent members of the population?
>
> Second, by "the same" being your definition of "the local name of all of the
> descendants" do you mean the "ordered set of local names of the descendants
> in document order" or "the unordered set of unique local names without
> duplicates" or something else?
>
> When I asked what you were trying to do I was looking for a sentence
> describing the *reason* why you wrote the expression, not what the
> expression was in a sentence.  What is the nature of these elements with
> descendants that they need to be grouped?  Is this an academic exercise or
> is there a reason the names are important to the grouping?  By trying to
> understand the problem being solved, someone on the list may be able to help
> you better than trying to fix something you've started that may turn out to
> have been an inappropriate way to start given the problem at hand.
>
> . . . . . . . . . . Ken
>

I understand but what I described is what I want to do - no it is not
an academic exercise.

See an example of the required grouping - attribute and text nodes may
be present but are ignored for the purpose of grouping.

<A>
  <!-- start group>
  <B>
     <C>
     <D>
  </B>
  <B>
     <C>
     <D>
  </B>
  <! --end group>
  <B>  *** singleton group
  <C>  *** singleton group
  <!-- start group>
  <D>
    <E>
    <E>
      <F>
     <E>
   </D>
   <D>
    <E>
    <E>
      <F>
     <E>
   </D>
   <!-- end group>
     <!-- start group>
  <B>
     <C>
     <D>
  </B>
  <B>
     <C>
     <D>
  </B>
  <! --end group>
  </A>

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.