[xsl] problems with nested templates

Subject: [xsl] problems with nested templates
From: "Christian Timmerer (ITEC)" <christian.timmerer@xxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Sep 2002 14:41:16 +0200
Hash: SHA1

hi all,
  i have some problems when creating a hierarchy of elements from a
flat structure ... assume we have following xml fragment (note that
inside the B's and C's are also some elements which content should be
copied to the result tree. there it will become an attribute and not
an element):

the numbers are help entries and not part of the xml file

  <B>...</B>	0
  <C>...</C>	1
  <C>...</C>	2
  <C>...</C>	3
  <C>...</C>	4
  <C>...</C>	5
  <C>...</C>	6
  <C>...</C>	7
  <C>...</C>	8
  <C>...</C>	9

der result should look like this:
 - the root element is nearly the same
 - B will be copied to B1 ... no problem (line 0 from above)
 - C (line 1) to C1 (no hierarchy needed - also not the problem)
 - C (line 2) here i'm beginning to introduce the hierarchy
	the C's (line 2, 3, 4) should be as shown below (the first element
containing inside C1's
... and so on


for achieving this i use <xsl:apply-templates
select="following-sibling::C[position() &lt; $someValue]/>

the problem is that i found the same elements copied into the
hierarchy after the element where the hierarchy structure begins. how
can i skip this elements? the number of element inside one hierarchy
structure differs and will be controlled by another xml document
which i include with the document() function.

i've also tried an iterative approach, but there i can't use the
position() function which i need to determine where the nested
structure begins ...

any hint/help would be appreciated

best regards

ps: the complete structure is rather extensive to post it in the
forum ;-)

Version: PGP 7.0.4


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

Current Thread