Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Conditional in-context nodeset variables

From: "Vyacheslav Sedov" <vyacheslav.sedov@--------->
To:
Date: 1/3/2008 4:48:00 PM
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,
also in case with wrong nesting best case for me is possibly wrongly
place some item in other section
then lost it at all

On Jan 3, 2008 7:38 PM, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:
> On 03/01/2008, Vyacheslav Sedov <vyacheslav.sedov@xxxxxxxxx> wrote:
> > 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 :)
>
> a cow on ice... :)
>
> Don't worry too much about push and pull - for grouping you have to
> use pull - and for-each-group is excellent (like most things in XSLT
> once you 'get' them)
>
> Here's an example using for-each-group with group-ending-with:
>
> <xsl:stylesheet
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     version="2.0">
>
>     <xsl:output indent="yes"/>
>
>     <xsl:variable name="input">
>         <div>
>             <p>p</p>
>             <h1></h1>
>             <h2></h2>
>             <p>p2</p>
>         </div>
>     </xsl:variable>
>
>     <xsl:template match="/">
>         <xsl:for-each-group select="$input/div/*" group-ending-with="h1|h2">
>             <group>
>                 <xsl:copy-of select="current-group()"/>
>             </group>
>         </xsl:for-each-group>
>     </xsl:template>
>
> </xsl:stylesheet>
>
> It generates this output:
>
> <group>
>    <p>p</p>
>    <h1/>
> </group>
> <group>
>    <h2/>
> </group>
> <group>
>    <p>p2</p>
> </group>
>
> Is that what you were after?  If not, modify the input and and
> required output and post back.
>
>
> --
>
> Andrew Welch
> http://andrewjwelch.com
> Kernow: http://kernowforsaxon.sf.net/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent