[xsl] suppressing only the last PI

Subject: [xsl] suppressing only the last PI
From: <Emily.Garrett@xxxxxxxxxxx>
Date: Wed, 3 Jan 2007 14:29:14 -0500
Hi,
I'm trying to insert some content prior to the last processing
instruction only if the value in the PI begins with 'PageEnd_'.

The following instruction successfully displays the last processing
instruction (and no others) following the content:
              <xsl:apply-templates
select="node()[self::processing-instruction('TL_XSL')[starts-with(.,'Pag
eEnd_')]][position()=last()]"/>

However, the following instruction occurs prior to the content and
should suppress only the last PI, but is suppressing all processing
instructions named TL_XSL and whose value beings with 'PageEnd_' and not
just the last one:

   <xsl:apply-templates
select="node()[not(self::processing-instruction('TL_XSL')[starts-with(.,
'PageEnd_')][position()=last()])]"/>

Can anyone tell what is wrong with it and why it is not just suppressing
the last one?  I am including the position()=last() instruction inside
the not(), where in the other one it is separated from the first
instruction, but this seems like it would work.  If I put the
position()=last() outside the not(), then it suppresses them all.

Thanks if you can help,
Emily Garrett

Current Thread