Re: [xslt] possible bug in xsltproc/libxslt


<xsl:sort select="/root/items/item[ item_id = @it_id]/@weight"

1/ check with the latest version

will do

2/ use xsltproc -v to see what is happening

I did that, but the output regarding sort was minimal or I did overlook something, as I couldn't find anything relevant.

  3/ there is no element with both attribute item_id and attribute
     it_id in your input data. You're trying to sort on non-existent

3/ seems to indicate your XSLT code is bugged your select sort criteria is just
wrong apparently.

hm... that might be the problem, indeed - but but but how to solve this then...?

<xsl:for-each select="/root/matches/match[ @cl_id = $class_id ]">
  <xsl:sort select="/root/items/item[ @item_id = @it_id ]/@weight"

Attribute @it_id should (in my hopes :) refer to the selected match element... what it apparently does not at all.

I tried to first set an variable that should hold the @it_id attribute and then use sort, like

<xsl:for-each select="/root/matches/match[ @cl_id = $class_id ]">
  <xsl:variable name="it_id" value="@it_id"/>
  <xsl:sort select="/root/items/item[ @item_id = $it_id ]/@weight"

but that's not working, as sort needs to be the first child of the for-each element.

I try to sort the _matches_ based on the weight of the _item_ elements they refer to.

Is there no way to refer to an attribute of the selected match element in the for-each loop, so that the sort can use it to get the needed weight ?

Looks like I'm making something terribly wrong, but I'm really a bit lost here, sorry for the confusions.

Any pointer welcome.

Many thanks,

Iosif Fettich

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]