Seeing the preceding sibling
‎Jul 27, 2010
05:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
‎Jul 27, 2010
05:46 PM
Seeing the preceding sibling
This is what I'm trying to do:
<xsl:if test="name(parent:receding-sibling)='volume">
Or
<xsl:if test="parent:receding-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:receding-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
<xsl:if test="name(parent:receding-sibling)='volume">
Or
<xsl:if test="parent:receding-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:receding-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
‎Jul 27, 2010
05:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
‎Jul 27, 2010
05:52 PM
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...
-Brandon
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:receding-sibling)='volume">
>
>
>
> Or
>
>
>
> <xsl:if test="parent:receding-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:receding-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
>
>
>
>
>
> ----------
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...
-Brandon
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:receding-sibling)='volume">
>
>
>
> Or
>
>
>
> <xsl:if test="parent:receding-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:receding-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
>
>
>
>
>
> ----------
‎Jul 28, 2010
03:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
‎Jul 28, 2010
03:39 PM
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
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