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

RE: Searching in Sub-children from an Array

Subject: RE: Searching in Sub-children from an Array
From: "Houman Khorasani" <Houman.Khorasani@xxxxxxxxxxx>
Date: Wed, 14 Feb 2007 17:27:06 -0000
RE:  Searching in Sub-children from an Array
>I believe the problem is in this line:
><xsl:copy-of
>select="(key('step',string-join(ancestor-or-self::*[@ID]/@ID,',')),.)[1
]"/>

>The section reading
>'(key('step',string-join(ancestor-or-self::*[@ID]/@ID,',')),.)' will
>select all matching Rate_Event nodes correctly, as well as the current
>node. The predicate at the end '[1]', will then take the first item in
>this list. I suspect you want to use some kind of conditional here...



You are right!! I had overlooked it. [*] has solved my problem. Many
thanks!!

One last question, I also had a mistake in the required XML output.
Maybe you can help me with that as well please:


XML Input is now slightly changed in <Rate_Structure_Event>, which
contains now few children called <Rate>:

<tree>
	<fruit ID="111">
		<mango ID="333">
			<colour>
				<Rate_Structure_Event
ConceptType="Rate_Structure_Event" ID="1">
					<Rate>bla</Rate>
					<Rate>bla</Rate>
					<Rate>bla</Rate>
				</Rate_Structure_Event>
			</colour>
		</mango>
		<orange ID="222">
			<color>orange</color>
		</orange>
	</fruit>
	<fruit_adjustment>
		<color>
			<Path>
				<Steps>111,333</Steps>
			</Path>
			<bla>false</bla>
			<Rate_Event ConceptType="Rate_Event"
ID="A"></Rate_Event>
			<Rate_Event ConceptType="Rate_Event"
ID="B"></Rate_Event>
		</color>
	</fruit_adjustment>
</tree>


Desired XML Output:

Exactly like before; but all <Rate> elements inside
<Rate_Structure_Event> shall be eliminated and replaced by all
<Rate_Event> inside <Fruit_adjustment> (Where the key is referring to
obviously, that's why we used Muecnhian Method). Only that the new
<Rate_Event> elements shall be actually renamed to <Rate>.

In other words the structure of the ouput doesn't change, the old <Rate>
are eliminated and new rates called <Rate_Event> replaces them without
forcing the element name to be changed from <Rate> to <Rate_Event>.

If this is not clear, I could give a simple example.

Many thanks for your advice,
Houman

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.