xsl-list
[Top] [All Lists]

RE: xsl:number counting "cousins"

2002-10-06 16:11:33
Doesn't 

<xsl:number level="any" from="table"/>

give you what you want?

The from attribute is a pattern, not an XPath expression, which explains
why you can't use the ancestor axis.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Gustaf Liljegren
Sent: 06 October 2002 21:29
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] xsl:number counting "cousins"


I have this source:

...
<colgroup>
  <col/>
  <col/>
  <col/>
</colgroup>
<colgroup>
  <col/>
</colgroup>
...

And this template:

<xsl:template match="col">
  <fo:table-column>
    <xsl:attribute name="column-number">
      <xsl:number count="col" from="ancestor::table//*"/>
    </xsl:attribute>
    ...
  </fo:table-column>
</xsl:template>

There's a fault here as you can see. The processor doesn't 
like what I put in the 'from' attribute. It can only be 
children, not "cousins", like here. Why this limitation? I 
think the above is pretty much straightforward. :-)

If I write like in the example in XSL (no 'from' attribute), 
I get problems like this:

<fo:table-column column-number="1" .../>
<fo:table-column column-number="2" .../>
<fo:table-column column-number="3" .../>
<fo:table-column column-number="1" .../>

It starts over when it steps into the new group. What's the solution?

Gustaf



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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