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

Re: Conditional in-context nodeset variables

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

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
starts-with(local-name(),'h')]">
        <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"
            select="following-sibling::*[string-length(local-name())
=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"
            select="following-sibling::*[string-length(local-name())
=2 and (substring(local-name(),1,1) = 'h') and
(substring(local-name(),2) = $level)][1]"/>
        <xsl:variable name="following-any-other-level-section-item"
            select="following-sibling::*[string-length(local-name())
=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:if>
        </xsl:element>
        <xsl:apply-templates select="$following-same-level-section-item"/>
    </xsl:template>

with best wishes,
Slav

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:
>
> http://www.biglist.com/lists/xsl-list/archives/200711/msg00487.html
> http://www.biglist.com/lists/xsl-list/archives/200711/msg00488.html
>
> David

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.