xml - XSLT following-sibling output not as expected -
i want elements between first sale , next sale. initial xml
<parent> <sale seqno="1"/> <discount seqno="2"/> <coupon seqno="4"/> <coupondetail seqno="5"/> <sale seqno="6"/> <sale seqno="7"/> <sale seqno="8"/> <payment seqno="9"/> </parent>
desired xml:
<discount seqno="2"/> <coupon seqno="4"/> <coupondetail seqno="5"/>
i have following applying template
following-sibling::*[(number(@seqno) < number(following::sale[1]/@seqno))]
output getting:
<discount seqno="2"/> <coupon seqno="4"/> <coupondetail seqno="5"/> <sale seqno="6"/> <sale seqno="7"/> <sale seqno="8"/> <payment seqno="9"/>
if hardcode in sequence number of next sale item correct output
following-sibling::*[(number(@seqno) < number(6))]
output:
<discount seqno="2"/> <coupon seqno="4"/> <coupondetail seqno="5"/>
what missing? appreciated.
the issue context in predicate being evaluated - it's particular element child of parent
being tested whether should included in resulting node-set. in context, following::sale[1]
gives first sale
element following element being tested, have higher @seqno
, if sale
element.
what need store sequence number of interest in xsl:variable
prior doing select, instance:
<xsl:variable name="end_seq_no" select="following-sibling::sale[1]/@seqno"/> <xsl:apply-templates select="following-sibling::*[@seqno < $end_seq_no]"/>
Comments
Post a Comment