[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] following-sibling problem


Subject: RE: [xsl] following-sibling problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 28 Oct 2004 15:54:11 +0100

What is the expression at

    select="current-group() except ..."/>

?

It should be "current-group() except ."

I think what you've sent would be a syntax error though.

Can't see anything else wrong: if necessary, post the source document again,
and a complete stylesheet that demonstrates the problem - it's one of those
that's hard to debug without running it.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Bruce D'Arcus [mailto:bdarcus@xxxxxxxxxxxxx] 
> Sent: 28 October 2004 14:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] following-sibling problem
> 
> 
> On Oct 27, 2004, at 9:38 AM, Michael Kay wrote:
> 
> > For a very similar problem I used:
> >
> > <xsl:template name="process-level">
> >   <xsl:param name="population" required="yes" as="element()*"/>
> >   <xsl:param name="level" required="yes" as="xs:integer"/>
> >   <xsl:for-each-group select="$population"
> >                       group-starting-with="*[xs:integer(@level) eq 
> > $level]">
> >     <xsl:element name="{@tag}">
> >       <xsl:copy-of select="@ID[string(.)], @REF[string(.)]"/>
> >       <xsl:value-of select="normalize-space(@text)"/>
> >       <xsl:call-template name="process-level">
> >         <xsl:with-param name="population" select="current-group() 
> > except
> > .."/>
> >         <xsl:with-param name="level" select="$level + 1"/>
> >       </xsl:call-template>
> >     </xsl:element>
> >   </xsl:for-each-group>
> > </xsl:template>
> >
> > Prime this with the population parameter set to the entire 
> sequence of 
> > key
> > elements, and level set to 0, and it will build the 
> hierarchy for you; 
> > you
> > only need to change the instructions that construct new elements and
> > attributes in the new hierarchy.
> 
> I'm a little stuck on this; I end up sending Saxon into an infinite 
> loop with my current code:
> 
> <xsl:template match="key:slide">
>    <div class="slide">
>      <xsl:apply-templates select="key:bullets"/>
>    </div>
> </xsl:template>
> 
> <xsl:template match="key:bullets">
>    <xsl:choose>
>      <xsl:when test="../@master-slide-id='master-slide-1'">
>        <xsl:apply-templates select="key:bullet[@level='0']" 
> mode="title"/>
>      </xsl:when>
>      <xsl:otherwise>
>        <xsl:call-template name="process-level">
>          <xsl:with-param name="bullet" select="key:bullet"/>
>          <xsl:with-param name="level" select="0"/>
>        </xsl:call-template>
>      </xsl:otherwise>
>    </xsl:choose>
> </xsl:template>
> 
> <xsl:template match="key:bullet[@level='0']" mode="title">
>    <h1><xsl:value-of select="$title"/></h1>
>    <h3><xsl:value-of select="$author"/></h3>
> </xsl:template>
> 
> <xsl:template name="process-level">
>    <xsl:param name="bullet" required="yes" as="element()*"/>
>    <xsl:param name="level" required="yes" as="xs:integer"/>
>    <xsl:for-each-group select="$bullet"
>                  group-starting-with="*[xs:integer(@level) eq 
> $level]">
>      <ul>
>        <li><xsl:value-of select="normalize-space(.)"/></li>
>        <xsl:call-template name="process-level">
>          <xsl:with-param name="bullet" select="current-group() except 
> ..."/>
>          <xsl:with-param name="level" select="$level + 1"/>
>        </xsl:call-template>
>      </ul>
>    </xsl:for-each-group>
> </xsl:template>


Current Thread