xsl-list
[Top] [All Lists]

passing_cousin_content_as_counter

2004-07-31 11:01:46




Hallo again,

and first of all, forgive me for having previously posted my question in
such a confusing way!

I was wondering if someone could, by the use of one stylesheet, select the
values of the first,
the fourth and the seventh <ELEM_INFO_ITEM> children of <ELEM_INFO>
element. Note that the number
of <ELEM_INFO_ITEM> nodes is not predefined.In this example there are
exactly nine nodes, but
in other cases there might be only three or twelve etch, but always number
that is multiple of
three.

I then would like to use the extracted values as counter values, to apply
counting on
the COORDINATE_ITEM node-set and select specific COORDINATE_ITEM
elements.In this example, based
on the extracted values (1, 7 and 11 ), i would like to select the first,
seventh and eleventh
COORDINATE_ITEM elements content.

The source xml is the one following:


<SHAPE>
- <ELEM_INFO>
     <ELEM_INFO_ITEM>1</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>1001</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>5000</ELEM_INFO_ITEM>

     <ELEM_INFO_ITEM>7</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>1002</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>5000</ELEM_INFO_ITEM>

     <ELEM_INFO_ITEM>11</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>1003</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>5000</ELEM_INFO_ITEM>
  </ELEM_INFO>
- <COORDINATES>
    <COORDINATES_ITEM>68</COORDINATES_ITEM>  !first
    <COORDINATES_ITEM>54</COORDINATES_ITEM>
    <COORDINATES_ITEM>72/COORDINATES_ITEM>
    <COORDINATES_ITEM>65</COORDINATES_ITEM>
    <COORDINATES_ITEM>83</COORDINATES_ITEM>
    <COORDINATES_ITEM>17</COORDINATES_ITEM>
    <COORDINATES_ITEM>20</COORDINATES_ITEM>  !seventh
    <COORDINATES_ITEM>60</COORDINATES_ITEM>
    <COORDINATES_ITEM>24</COORDINATES_ITEM>
    <COORDINATES_ITEM>55</COORDINATES_ITEM>
    <COORDINATES_ITEM>98</COORDINATES_ITEM>  !eleventh
    <COORDINATES_ITEM>25</COORDINATES_ITEM>
  <COORDINATES>
</SHAPE>


Can this be achieved with the use of one and only stylesheet??The output i
want to generate
should be identical with the source, except for that the selected
COORDINATE_ITEM elements
will also contain a character like d for example, concatenated with their
number value.That
last thing is very easy with the use of concat, but what about the previous
issues.They look
quite heavy programmaticaly for xslt. Should i use variables??


output xml


<SHAPE>
- <ELEM_INFO>
     <ELEM_INFO_ITEM>1</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>1001</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>5000</ELEM_INFO_ITEM>

     <ELEM_INFO_ITEM>7</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>1002</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>5000</ELEM_INFO_ITEM>

     <ELEM_INFO_ITEM>11</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>1003</ELEM_INFO_ITEM>
     <ELEM_INFO_ITEM>5000</ELEM_INFO_ITEM>
  </ELEM_INFO>
- <COORDINATES>
    <COORDINATES_ITEM>d68</COORDINATES_ITEM> !first
    <COORDINATES_ITEM>54</COORDINATES_ITEM>
    <COORDINATES_ITEM>72/COORDINATES_ITEM>
    <COORDINATES_ITEM>65</COORDINATES_ITEM>
    <COORDINATES_ITEM>83</COORDINATES_ITEM>
    <COORDINATES_ITEM>17</COORDINATES_ITEM>
    <COORDINATES_ITEM>d20</COORDINATES_ITEM>  !seventh
    <COORDINATES_ITEM>60</COORDINATES_ITEM>
    <COORDINATES_ITEM>24</COORDINATES_ITEM>
    <COORDINATES_ITEM>55</COORDINATES_ITEM>
    <COORDINATES_ITEM>d98</COORDINATES_ITEM> !eleventh
    <COORDINATES_ITEM>25</COORDINATES_ITEM>
  <COORDINATES>
</SHAPE>


Regards
Manousos
Athens



<Prev in Thread] Current Thread [Next in Thread>
  • passing_cousin_content_as_counter, mankar <=