|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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.")
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








