Re: [xsl] Xpath question with processing-instruction()

Subject: Re: [xsl] Xpath question with processing-instruction()
From: Lars Huttar <lars_huttar@xxxxxxx>
Date: Thu, 19 Aug 2010 14:23:02 -0500
 On 8/19/2010 12:59 PM, Martin Honnen wrote:
> Ylvisaker, Steve wrote:
>> I need to test to see if my parent has an immediate preceding sibling
>> of processing-instruction named "ModuleStart"
>>
>> If so I need to know the content of that PI.
>>
>>
> Well if we take white space text nodes into account then the title
> element is not immediately preceded by a processing instruction,
> rather by a text node. So maye
>   <xsl:variable name="n"
> select="../preceding-node()[not(self:text(normalize-space()))][1][self::processing-instruction()]"/>

Since it needs to be named "ModuleStart":
  select="...[self::processing-instruction('ModuleStart')]"

Can you explain how
   [not(self::text(normalize-space()))]
works?
I think it's supposed to filter out whitespace-only text nodes, but I
don't see anything in the spec about text() taking an argument.

Maybe you meant something like
    [not(self::text()[not(normalize-space())])]
?

Thanks,
Lars

>   <xsl:if test="$n">
>      <xsl:value-of select="$n"/>
>   </xsl:if>

Current Thread