Hi,
wenn ich eine sort anweisung haben, wiese diese hier:
<xsl:sort select="position() < ($anzahl - ($positionsnummer))" data-type="number" order="ascending"/>
Hm. Du sortierst numerisch (data-type="number") nach einem Wahrheitswert (select="... < ...").
Laut XSLT Recommendation wird zuerst das Ergebnis des select-Ausdrucks in einen String umgewandelt, im Falle von booleans zu 'true' oder 'false'.
(Zitat: xsl:sort has a select attribute whose value is an expression. For each node to be processed, the expression is evaluated with that node as the current node and with the complete list of nodes being processed in unsorted order as the current node list. The resulting object is converted to a string as if by a call to the string function; this string is used as the sort key for that node. "
- Zitat: "The boolean false value is converted to the string false. The boolean true value is converted to the string true.")
Das data-type sorgt für eine Umwandlung des Sort-keys in eine Zahl.
(Zitat: "number specifies that the sort keys should be converted to numbers and then sorted according to the numeric value; the sort key is converted to a number as if by a call to the number function;" + Zitat: "a string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 number that is nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string; any other string is converted to NaN")
Da weder 'true' noch 'false' eine Zahl repräsentiert, sollte das Ergebnis immer 'NaN' sein. Alle Elemente haben also bezüglich der Sortierung denselben Wert. Da die Sortierung stable ist ("The sort must be stable: in the sorted list of nodes, any sub list that has sort keys that all compare equal must be in document order."), wird die Reihenfolge wie im Dokument beibehalten.
kann ich ja hiermit:
<xsl:if test="position()=last()">
den letzten Wert bestimmen.
Jetzt würde ich gerne wissen ob der letzte Wert, von dieser "$anzahl - ($positionsnummer)" positionsnummer kommt oder von einer position weiter unten?
Was meinst Du damit? Da Du nicht sagst, was diese $positionsnummer ist und was $anzahl, ist da schwer was dazu zu sagen.
cu,
Andreas
Warum nennt sich Andreas hier MudGuard?
Schreinerei Waechter
O o ostern ...
Fachfragen unaufgefordert per E-Mail halte ich für unverschämt und werde entsprechende E-Mails nicht beantworten. Für Fachfragen ist das Forum da.