cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Seeing the preceding sibling

ptc-3050150
1-Visitor

Seeing the preceding sibling

This is what I'm trying to do:

<xsl:if test="name(parent:Smiley Tonguereceding-sibling)='volume">

Or

<xsl:if test="parent:Smiley Tonguereceding-sibling::volume">

Some of these XPath chapters show 3 in a row, but the parser just goes Pffft.

Test if the parent's preceding sibling is <volume>.

The parent tag varies, but will either have <volume> right above it or it won't.

I've written it a hundred ways wrong and now my eyes are blurred from banging my head on my desk.

Can't even run a good test to find it.

<xsl:value-of select="name(parent:Smiley Tonguereceding-sibling)"/">

Adding ::node() just throws a parser error.

Thanks...hope it is just another can't see the forest for the trees...what am I missing?


John T. Jarrett CDT
Senior Tech Writer, Integrated Logistics Support, Land & Armaments/Global Tactical Systems

T 832.673.2147 | M 832.363.7234 | F 832.673.2376 | x1147 | -<">mailto:->
BAE Systems, 5000 I-10 West, Sealy, Texas USA 77474
www.baesystems.com
2 REPLIES 2

John,

There can only be one axis specifier ("parent::",
"preceding-sibling::", etc.) per step and it must be followed by a
node test.  So, your case would be something like:

<xsl:if test="parent::*/preceding-sibling::volume">...</xsl:if>

or just:

<xsl:if test="../preceding-sibling::volume">...</xsl:if>

Note that this would be true if *any* of the parent's preceding
siblings are a "volume" element.  To check if just the immediately
preceding sibling is a volume:

<xsl:if test="../preceding-sibling::*[1][self::volume]">...</xsl:if>

Hope your head gets better... Smiley Wink

-Brandon Smiley Happy


On Tue, Jul 27, 2010 at 5:46 PM, Jarrett, John T (US SSA)
<-> wrote:
> This is what I’m trying to do:
>
>
>
> <xsl:if test="name(parent:Smiley Tonguereceding-sibling)='volume">
>
>
>
> Or
>
>
>
> <xsl:if test="parent:Smiley Tonguereceding-sibling::volume">
>
>
>
> Some of these XPath chapters show 3 in a row, but the parser just goes
> Pffft.
>
>
>
> Test if the parent’s preceding sibling is <volume>.
>
>
>
> The parent tag varies, but will either have <volume> right above it or it
> won’t.
>
>
>
> I’ve written it a hundred ways wrong and now my eyes are blurred from
> banging my head on my desk.
>
>
>
> Can’t even run a good test to find it.
>
>
>
> <xsl:value-of select="name(parent:Smiley Tonguereceding-sibling)"/">
>
>
>
> Adding ::node() just throws a parser error.
>
>
>
> Thanks…hope it is just another can’t see the forest for the trees…what am I
> missing?
>
>
>
>
>
> John T. Jarrett CDT
>
> Senior Tech Writer, Integrated Logistics Support,Land & Armaments/Global
> Tactical Systems
>
>
>
> T832.673.2147 | M 832.363.7234 | F 832.673.2376| x1147 |
> -
>
> BAE Systems, 5000 I-10 West, Sealy, Texas USA 77474
>
> www.baesystems.com
>
>
>
>
>
> ----------

Brandon,

Thanks for the lecture! Finished it up today and my head feels much better now.

I bow in your presence...

John T. Jarrett CDT
Senior Tech Writer, Integrated Logistics Support,Land & Armaments/Global Tactical Systems

T832.673.2147 | M 832.363.7234 | F 832.673.2376| x1147 | -
BAE Systems, 5000 I-10 West, Sealy, Texas USA 77474
www.baesystems.com

Announcements

Top Tags