Re: [xsl] Conditional in-context nodeset variables

Subject: Re: [xsl] Conditional in-context nodeset variables
From: "Vyacheslav Sedov" <vyacheslav.sedov@xxxxxxxxx>
Date: Thu, 3 Jan 2008 20:30:22 +0300

i solve problem for case with properly "nested" h-tags & have space to
grow into healing mode :)

here my code (here some "unemployment" yet variables - it for future
"healing" purposes)

<xsl:template match="*[string-length(local-name()) =2 and
        <xsl:variable name="this-level-name" select="local-name()"/>
        <xsl:variable name="level" select="substring($this-level-name,2)"/>
        <xsl:variable name="next-level"
select="concat('h',xs:string(xs:integer($level) + 1))"/>
        <xsl:variable name="following-any-section-element"
=2 and (substring(local-name(),1,1) = 'h')][1]"/>
        <xsl:variable name="following-next-level-section-item"
            select="following-sibling::*[local-name() = $next-level][1]"/>
        <xsl:variable name="following-same-level-section-item"
=2 and (substring(local-name(),1,1) = 'h') and
(substring(local-name(),2) = $level)][1]"/>
        <xsl:variable name="following-any-other-level-section-item"
=2 and (substring(local-name(),1,1) = 'h') and (not(local-name() =
($this-level-name, $next-level)))][1]"/>
        <xsl:variable name="next-margin" select="if
($following-any-section-element) then ($following-any-section-element)
else (following-sibling::*[last()])"/>

        <xsl:element name="sect{$level}">
            <xsl:apply-templates mode="sect-title"/>
            <xsl:apply-templates select="following-sibling::node()[.
&lt;&lt; $next-margin]"/>
            <xsl:if test="$next-margin is $following-next-level-section-item">
                <xsl:apply-templates select="$next-margin"/>
        <xsl:apply-templates select="$following-same-level-section-item"/>

with best wishes,

On Jan 3, 2008 7:54 PM, David Carlisle <davidc@xxxxxxxxx> wrote:
> > well... group h1 must include all h2 groups and same with any other  h level,
> > also i must get chance to any other elements
> > not only to be just copied but "touched" by others templates,
> sounds like the same problem addressed in the thread:
> David

Current Thread