[xsl] 1st previous node()

Subject: [xsl] 1st previous node()
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Mon, 7 Feb 2011 23:16:05 -0700
XSL1.0
I need help finding the first previous node, skipping white space,
comments, etc.. I thought this might work, but I can't get it or
similar tries to work.

<xsl:variable name="previous" select="preceding::node()
   [not(comment())]
   [not(text())]
   [not(processing-instruction())]
   [1]"/>

Given that <X> is the context node then I expect the previous node is <M>.

<A>
 <M>
   <?skip me?>
   <!--skip me-->
  </M>
  <X> this is context node </X>
</A>

Given that <X> is the context node then I expect the previous node is <B>.

<A>
 <B>
  <X> this is context node </X>
 </B>
</A>



--
Karl Stubsjoen
MeetScoresOnline.com
(602) 845-0006

Current Thread