xsl-list
[Top] [All Lists]

Re: how to set the pattern to get the node

2004-11-30 11:39:11
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 


Thanks



 --- Geert Josten <Geert(_dot_)Josten(_at_)daidalos(_dot_)nl> wrote: 
Hi Que Li,

How I can get the node which parent_ID =1 or
parent_ID
is not 1 but No other sibling node List_ID equal
to
current node parent_ID

I try to use:
   <xsl:template match="List[Parent_ID=1 or
not(../List[List_ID = current()/Parent_ID])] ">

The value of current() changes during the evaluation
of a Path in an XPath expression. It is not 
pointing to the List element for which the math
pattern is being tested.

Besides, you might want to rule out the List element
under consideration from the test on the siblings..

You could try the following:

<xsl:template match="List">
   <xsl:variable name="self" select="."/> <!--
current() can be shortened to . -->
   <xsl:choose>
     <xsl:when test="Parent_ID = 1">
       <!-- found a valid case -->
     </xsl:when>
     <xsl:when
test="not(preceding-sibling::List[List_ID =
$self/@Parent_ID]
                         or
following-sibling::List[List_ID =
$self/@Parent_ID])">
       <!-- found second valid case -->
     </xsl:when>
     <!-- xsl:otherwise? -->
   </xsl:choose>
</xsl:template>

Cheers,
Geert


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

 

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