Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] variablesAsCounters

From: mankar@---------------
To:
Date: 8/1/2004 1:44:00 AM
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 nodeset 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent