[xsl] Re: current()

Subject: [xsl] Re: current()
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 27 Nov 2001 23:07:54 +0100
I forgot the outputs:

Xalan 2.2.D9 - the 'working' version, I expect this output:

<target>
<name>srctest</name>
<depends>test1.virbus.de::srctest</depends>
<depends>test3.virbus.de::srctest</depends>
</target>
<target>
<name>srctest2</name>
<depends>test2.virbus.de::srctest2</depends>
</target>

Xalan 2.2.D13:

<target>
<name>srctest</name>
<depends>test1.virbus.de::srctest</depends>
<depends>test3.virbus.de::srctest</depends>
</target>
<target>
<name>srctest2</name>
<depends>test2.virbus.de::srctest2</depends>
</target>
<target>
<name>srctest</name>
<depends>test3.virbus.de::srctest</depends>
</target>

Regards,

Joerg


> Hi,
>
> I have a problem with unique nodes by using preceding-sibling-axis and the
> current()-function.
>
> My XML:
>
> <cluster>
>     <inst machine="test1.virbus.de" inst-src="srctest"/>
>     <inst machine="test2.virbus.de" inst-src="srctest2"/>
>     <inst machine="test3.virbus.de" inst-src="srctest"/>
> </cluster>
>
> My XSL:
>
> <xsl:template match="cluster">
>     <xsl:apply-templates
>
select="inst[not(preceding-sibling::inst[@inst-src=current()/@inst-src])]"/>
> </xsl:template>
>
> <xsl:template match="inst">
>     <target>
>         <name><xsl:value-of select="@inst-src"/></name>
>         <xsl:for-each
> select=".|following-sibling::inst[@inst-src=current()/@inst-src]">
>             <depends><xsl:value-of
> select="concat(@machine,'::',@inst-src)"/></depends>
>         </xsl:for-each>
>     </target>
> </xsl:template>
>
> What's wrong with
> 'inst[not(preceding-sibling::inst[@inst-src=current()/@inst-src])]'? The
> only thing I can imagine is the current()-function. Shouldn't it relate to
> the inst, I'm testing on for applying?
>
> The above stylesheet is working with Xalan 2.2.D9, but not with the later
> versions. I want to know which is the correct behaviour. With MSXML 4 it
> doesn't work too.
>
> Regards,
>
> Joerg


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


Current Thread