xsl-list
[Top] [All Lists]

RE: how to set the pattern to get the node

2004-11-30 14:03:46
I am so confused that why I can use
 <xsl:when test="Parent_ID=1 or
not(preceding-sibling::List[List_ID = $self/Parent_ID]
 or following-sibling::List[List_ID =
$self/Parent_ID])"> 

 to get node which I wnat 
but when I 
use 

 <xsl:template match="List[Parent_ID=1or
not(preceding-sibling::List[List_ID=Parent_ID]  or
following-sibling::List[List_ID=Parent_ID])]">

It is not filter properly 


You're having trouble understanding context. Within a predicate, path
expressions are evaluated relative to the node that you're testing. So 

List[List_ID=Parent_ID]

means "find List elements whose List_ID is equal to their Parent_ID", for
example

<List>
  <List_ID>12</List_ID>
  <Parent_ID>12</Parent_ID>
</List>

If your data contained

<List>
  <List_ID>12</List_ID>
  <Parent_ID>12</Parent_ID>
  <Parent_ID>23</Parent_ID>
</List>

that would be selected as well.

But when you write

List[List_ID=$self/Parent_ID]

then you are selecting List elements whose List_ID is equal to the Parent_ID
of the node held in variable $self.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>