Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] passing_cousin_content_as_counter

From: mankar@---------------
To:
Date: 8/1/2004 7:49:00 PM
Hallo Mr Kay,

and first of all let me express my gratitude, since your advice has
been crucial in several occasions.
I used the two templates you sent me in one stylesheet like the one
below:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="*">
<xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy>
</xsl:template>
<xsl:template match="COORDINATES_ITEM[position() =
    /SHAPE/ELEM_INFO/ELEM_INFO_ITEM[position() mod 3 = 0]]">
  <xsl:copy>
    <xsl:text>d</xsl:text>
    <xsl:value-of select="."/>
  </xsl:copy>
</xsl:template>
</xsl:stylesheet>

and while it seems pretty logical to just select the relevant
COORDINATES_ITEM elements
and add a d character in front of their number content, it doesn't.It
produces an identical
xml doc with the source one.It looks like, it ignores the second template
and just applies
the first identity template, producing exactly the same document.

It's true that i had never seen a predicate, like the one used
in the second template, before. It seems that the [position() =
SHAPE/ELEM_INFO/ELEM_INFO_ITEM[position() mod 3 = 0]] is not taken
under consideration at all.

The source xml is:

<?xml version="1.0" encoding="ISO-8859-7"?>
<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_ITEM>15</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>
     <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>
     <COORDINATES_ITEM>60</COORDINATES_ITEM>
     <COORDINATES_ITEM>24</COORDINATES_ITEM>
     <COORDINATES_ITEM>55</COORDINATES_ITEM>
     <COORDINATES_ITEM>98</COORDINATES_ITEM>
     <COORDINATES_ITEM>25</COORDINATES_ITEM>
     <COORDINATES_ITEM>98</COORDINATES_ITEM>
     <COORDINATES_ITEM>25</COORDINATES_ITEM>
<COORDINATES_ITEM>98</COORDINATES_ITEM>
     <COORDINATES_ITEM>25</COORDINATES_ITEM>
   </COORDINATES>
 </SHAPE>

The ELEM_INFO element has 12 exactly children this time and according to
the declared
predicate the values 1,7,11 and 15 of the corresponding 1st, 4th, 7th and
10th ELEM_INFO_ITEM
elements should have been selected in order to pick the 1st,7th,11th and
15th COORDINATES_ITEM
elements and add a d in front of their content.Why do you think the second
isn't the second template taking any affect??

Thank you once more for your valuable time and advice.

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