xsl-list
[Top] [All Lists]

RE: Problem for : increment a variable in a for-each?

2004-11-29 08:46:10
Hi Mike:
   I try to use some example to explain my question.I
really need fix it.

Example:
My xml file is:
<List>
   <List_ID>10</List_ID>
   <Title>A</Title>
   <ParentID>1</parentID>
</List>
<List>
   <List_ID>11</List_ID>
   <Title>B</Title>
   <ParentID>1</parentID>
</List>
<List>
   <List_ID>12</List_ID>
   <Title>C</Title>
   <ParentID>10</parentID>
</List>
<List>
   <List_ID>13</List_ID>
   <Title>D</Title>
   <ParentID>10</parentID>
</List>
<List>
   <List_ID>14</List_ID>
   <Title>E</Title>
   <ParentID>15</parentID>
</List>

what I need do :
1. Find all <list> node which parentID=1 (Example
List_ID ia 10 and 11) 
I can use pattern as : select="List[parentID=1]"

2.and find all the 
<list> node which parentID not equal 1 but also no
List_ID on the xml equal to the current parentID
(Example: List_ID is 14. so Its parentID is 15. when
we search all List node where List_ID =15 .no macth 
so List_ID=14 is node which I need count)

For List_ID is 12 and 13, their parentID is 10. when I
search List node which ID is equal current node
parentID (now it is 10) and it exist so List_ID is 12
and 13 is not what I want.


so in the xml file ,three node satisfy my filter
condition:They are 
<List>
   <List_ID>10</List_ID>
   <Title>A</Title>
   <ParentID>1</parentID>
</List>
<List>
   <List_ID>11</List_ID>
   <Title>B</Title>
   <ParentID>1</parentID>
</List> 
<List>
   <List_ID>14</List_ID>
   <Title>E</Title>
   <ParentID>15</parentID>
</List>

then I need do different things based on the node
position in the satisfiled node( not all the node
list) 
It is my problem. no matter what I use, I can't find
the position inside node which I filter from original
source since position() will tell you the position on
the source.


I wish you can understand my question now.

Thanks
Helena

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--