xsl-list
[Top] [All Lists]

RE: following-sibling problem

2004-10-28 07:54:11
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(_at_)myrealbox(_dot_)com] 
Sent: 28 October 2004 14:13
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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="{(_at_)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[(_at_)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[(_at_)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>


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>