xsl-list
[Top] [All Lists]

RE: [xsl] Searching in Sub-children from an Array

2007-02-14 10:26:31
 

I believe the problem is in this line:
<xsl:copy-of
select="(key('step',string-join(ancestor-or-self::*[(_at_)ID]/@ID,',')),.)[1
]"/>

The section reading
'(key('step',string-join(ancestor-or-self::*[(_at_)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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>