[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 19:22:52 +0300
Re:  Conditional in-context nodeset variables
yep - it small simplified part of big code (more precisely - just testcase),
i don`t use xsl:...group since it make my code behavior like it use pull model,
but i am trying to use push model - maybe it wrong & i just not
familiar with grouping,
i feel myself with this task like cow on ice :)

guess i need take pen and paper and first perform this task on it -
look like it not solved mentally :)

by the way  - in my case i began use select="if () then () else ()"
structure - look like it work as expected,
i am not fan of several-lines long attributes but at least it work

with best wishes,
Slav

On Jan 3, 2008 6:56 PM, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:
>
> On 03/01/2008, Vyacheslav Sedov <vyacheslav.sedov@xxxxxxxxx> wrote:
> > have problem
> >
> > for example (as input any valid XHTML)
> > and context is first h1 node
> >
> >
> >         <xsl:variable name="level1" select="following-sibling::h1[1]"/>
> >         <xsl:variable name="level2" select="following-sibling::h2[1]"/>
> >
> >         <xsl:variable name="next-stop">
> >             <xsl:choose>
> >                 <xsl:when test="not($level1 and $level2)">
> >                     <xsl:sequence select="following-sibling::*[last()]"/>
> >                 </xsl:when>
> >                 <xsl:when test="$level1 &lt;&lt; $level2">
> >                     <xsl:sequence select="$level1"/>
> >                 </xsl:when>
> >                 <xsl:otherwise>
> >                     <xsl:sequence select="$level2"/>
> >                 </xsl:otherwise>
> >             </xsl:choose>
> >         </xsl:variable>
> >
> > <xsl:apply-templates select="following-sibling::*[. &lt;&lt $next-stop]"/>
> >
> > $level1 and $leve2 contain links to live in-context node
> > but variable $next-stop contain copy (not reference to node) of level1
> > or level2 variable
> > and even following-sibling::*[last()] provide just copy instead of
> > in-context nodeset
> > so << not work as expected :(
>
> Is it just the usual problem of $next-stop being a document-node()? If
> so you need:
>
> <xsl:variable name="next-stop" as="element()">
>
> It looks like you are trying to do positional grouping - maybe look at
> xsl:for-each-group using group-ending-with.
>
> By the way, if you provide a small complete sample input, with a
> complete stylesheet that highlights the problem then it's easy for
> people to cut and paste the samples and reproduce your problem.  Not
> many will be bothered to mock up an input...
>
> cheers
> --
> Andrew Welch
> http://andrewjwelch.com
> Kernow: http://kernowforsaxon.sf.net/

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.