[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: test for ancestral attribute returning variant re

Subject: Re: test for ancestral attribute returning variant results
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 24 Oct 2021 18:02:23 -0000
Re:  test for ancestral attribute returning variant  re
On Sun, Oct 24, 2021 at 05:42:38PM -0000, Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx scripsit:
[why is this test of version attributes afflicting me?]

I am not going to claim I fully understand the logic you've presented,
but I think you've got three cases:

1. the context item doesn't have an @version
2. the context item has an @version which does NOT differ by value from the first ancestor @version attribute
3. the context item has an @version which differs by value from the first ancestral @version attribute

In which case, I don't think you want:

<xsl:variable name="ancv" select=ancestor::*[@version][1]" />

I think you'd want something like (just typed! here! not in oXygen!)

<!-- I would reflexively do this on attributes but I think you want the
element context for page position -->
<xsl:variable name="versions" as="element()+" select="ancestor-or-self::*[normalize-space(@version)])" />

<xsl:choose>
    <xsl:when test="not(self::*[normalize-space(@version)]">
        <!-- the context item doesn't have a version;
        the context item's closest ancestral version is $versions[1] -->
    </xsl:when>
    <xsl:when test="$versions[1]/@version eq $versions[2]/@version">
        <!-- the context item version matches the closest ancestor version -->
    </xsl:when>
    <xsl:when test="$versions[1]/@version ne $versions[2]/@version">
        <!-- the context item version is different from the closest ancestor version
        -->
    </xsl:when>
    <xsl:otherwise>
        <xsl:message>Something completely unexpected has happened</xsl:message>
    </xsl:otherwise>
</xsl:choose>

Is that somewhere in the vague vicinity?

-- 
Graydon Saunders  | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor  ("That passed, so may this.")

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.