|
Subject: Re: [xsl] test for ancestral attribute returning variant results From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 24 Oct 2021 18:02:23 -0000 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] test for ancestral attribute , Trevor Nicholls trev | Thread | Re: [xsl] test for ancestral attrib, Dimitre Novatchev dn |
| [xsl] test for ancestral attribute , Trevor Nicholls trev | Date | Re: [xsl] test for ancestral attrib, Dimitre Novatchev dn |
| Month |