I had a good look at my xslt sheet and , i only use position in match key or
with other context in use.
Sorry for that, my only excuse it's a very bad cold...
But could you test that, please ?
My xml example
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="D:\Mes
documents\testxml\positioncle.xslt"?>
<a>
<b>11</b>
<b>12</b>
<b>13</b>
<b>14</b>
<b>15</b>
<b>16</b>
<b>17</b>
<b>18</b>
</a>
My XSLT example
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="part" match="b[(position() - 1) mod 3!=0]"
use="generate-id(../b[(position() - 1) mod 3=0 and
((following-sibling::b)[position()<3])[generate-id(.)=generate-id(current(
))]])"/>
<xsl:template match="/">
<r>
<xsl:for-each select="*/b[(position() - 1) mod 3=0]">
<c>
<xsl:apply-templates select=".|key('part',generate-id(.))"/>
</c>
</xsl:for-each>
</r>
</xsl:template>
<xsl:template match="b">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
I think it's too complicated and maybe it can be false but i'm curious to know
what you think about idea
----- Message d'origine -----
De : "Erwan AMOUREUX" <erwan.amoureux@xxxxxxxxxxxxxxxxxxxxxxx>
@ : <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Envoyi : jeudi 21 octobre 2010 09:36
Objet : Re: question on EXSLT data partitioning
My mistake!
sorry
----- Message d'origine -----
De : "Michael Kay" <mike@xxxxxxxxxxxx>
@ : <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Envoyi : mercredi 20 octobre 2010 16:24
Objet : Re: question on EXSLT data partitioning
>
>> For me it's logical
>> When you use global variable, current node is root, so with the key ,it's
the same thing and position is calculated with the root as initial context
>>
>
> Whether it's logical or not, the specification is quite clear. In XSLT 1.0:
>
> the expression specified in the use attribute of the xsl:key element is
> evaluated with x as the current node and with a node list containing
> just x as the current node list
>
> So position() in the use expression returns 1.
>
> Michael Kay
> Saxonica
| Current Thread |
|
Michael Kay - 19 Oct 2010 15:33:33 -0000
|
|