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

Re: best-technique for selective group and merge?

Subject: Re: best-technique for selective group and merge?
From: "James A. Robinson" <jimr@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 02 Mar 2004 08:43:45 -0800
param id
On Tue, 02 Mar 2004 08:31:01 -0800 I wrote:
< 
< Given input of the form
< 
<   <?xml version="1.0"?>
<   <config_datastore>
<     <feature name="a">
<       <config id="1">
<         <param id="x">x</param>
<       </config>
<     </feature>
< ...

Ugh, my apologies. I didn't send a complete example which shows the
problem I'm trying to solve. The feature can contain multiple configs,
each of which I want to merge across features:

  <?xml version="1.0"?>
  <config_datastore>
    <feature name="a">
      <config id="1">
        <param id="x">x</param>
      </config>
      <config id="2">
        <param id="xx">xx</param>
      </config>
      <config id="3">
        <param id="xxx">xxx</param>
      </config>
    </feature>
    <feature name="b">
      <config id="1">
        <param id="y">y</param>
      </config>
      <config id="2">
        <param id="yy">yy</param>
      </config>
    </feature>
    <feature name="c">
      <config id="1">
        <param id="z">z</param>
      </config>
      <config id="2">
        <param id="zz">zz</param>
      </config>
    </feature>
    <site>
      <has_feature name="a"/>
      <has_feature name="c"/>
    </site>
  </config_datastore>

I want to be able to select /config_datastore/site/* and perform selective
grouping (on feature @name) and merging (on the feature/config elements)
to return:

  <config id="1">
    <param id="x">x</param>
    <param id="z">z</param>
  </config>
  <config id="2">
    <param id="xx">x</param>
    <param id="zz">z</param>
  </config>
  <config id="3">
    <param id="xxx">xxx</param>
  </config>

The tree fragment example I posted shows essentially what I have now,
I can grab the each major config set, but I then want to perform a merge.
The example I posted makes it look like I could just run

  <xsl:copy-of select="key('feature', @name)/config/*"/>

but I can't, because each config has it's own uniqueness
(id 1, id 2, id 3, etc.).

I'll go get some coffee now before I try and post again.

Jim
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       jim.robinson@xxxxxxxxxxxx
Stanford University HighWire Press      http://highwire.stanford.edu/
650-723-7294 (W) 650-725-9335 (F)   

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.