xsl-list
[Top] [All Lists]

creating and using a XML nodelist within an XSL template

2002-12-30 10:41:31
is it possible to create an XML nodelist for use solely later on in the XSL
template?  I don't want to output the XML nodelist, I merely want to have
the XSL template use it later in its processing.

what I have is a XML file with 2 ids with information that is grouped.  What
I want to find is the top 2 groups (based on average of the 2 values) and
then output a nodelist that is comprised of the each id and its values for
the aforementioned top 2 groups

I was trying to have one FOR-EACH that summed up the group values, but can't
seem to figure out how to a) determine what the top 2 groups are, and b) how
to use that information later when I am outputting the information?

in the below example, it would have the following INPUT and OUTPUT

INPUT
<items>
<item id='a'>
    <group>1</group>
    <value>3</value>
</item>
<item id='a'>
    <group>2</group>
    <value>7</value>
</item>
<item id='a'>
    <group>3</group>
    <value>2</value>
</item>
<item id='a'>
    <group>4</group>
    <value>2</value>
</item>
<item id='b'>
    <group>1</group>
    <value>1</value>
</item>
<item id='b'>
    <group>2</group>
    <value>9</value>
</item>
<item id='b'>
    <group>3</group>
    <value>4</value>
</item>
<item id='b'>
    <group>4</group>
    <value>2</value>
</item>
</items>


OUTPUT
<items>
<item id='a'>
    <group>2</group>
    <value>7</value>
</item>
<item id='a'>
    <group>3</group>
    <value>2</value>
</item>
<item id='b'>
    <group>2</group>
    <value>9</value>
</item>
<item id='b'>
    <group>3</group>
    <value>4</value>
</item>
</items>


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



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