CASE 1:
<Loop type="MAIN01" name="MAIN01 Data">
<RepeatingSegment type="MAIN01" name="MAIN REP SEG">
<Segment type="MAIN01" name="MAIN SEG">
<Element type="350" name="Element_Of_Main01" param=" ">1</Element>
</Segment>
</RepeatingSegment>
<Loop type="POOT" name="POOT Data">
<RepeatingSegment type="POOT" name="POOT REP SEG">
<Segment type="POOT" name="POOT SEG">
<Element type="349" name="Element_Of_POOT" dt="I" param=" ">F</Element>
</Segment>
</RepeatingSegment>
</Loop>
<Loop type="SAC" name="Service, Promotion, Allowance, or Charge Information">
<RepeatingSegment type="SAC" name="Service, Promotion, Allowance, or Charge Information - REP SEG">
<Segment type="SAC" name="Service, Promotion, Allowance, or Charge Information">
<Element type="248" name="Allowance or Charge Indicator" dt="I" >C</Element>
</Segment>
</RepeatingSegment>
</Loop>
</Loop>
CASE 2:
<Loop type="MAIN01" name="MAIN01 Data">
<RepeatingSegment type="MAIN01" name="MAIN REP SEG">
<Segment type="MAIN01" name="MAIN SEG">
<Element type="350" name="Element_Of_Main01" param=" ">1</Element>
</Segment>
</RepeatingSegment>
<Loop type="POOT" name="POOT Data">
<RepeatingSegment type="POOT" name="POOT REP SEG">
<Segment type="POOT" name="POOT SEG">
<Element type="349" name="Element_Of_POOT" dt="I" param=" ">F</Element>
</Segment>
</RepeatingSegment>
</Loop>
</Loop>
场景,我想在案例 1 的“SAC”之前和案例 2 的“POOT”之前插入一个图片。
当前现有的逻辑只是通过外循环 MAIN01 ,在段 type = "MAIN_01" 的末尾插入图像。这意味着在案例 1 中,图像在“POOT”之前显示得非常好。
<xsl:if test="(ancestor::Loop[1]/@type = 'MAIN01' or ancestor::Loop[2]/@type = 'MAIN01') and (ancestor::RepeatingSegment/following-sibling::Loop or ancestor::RepeatingSegment[1]/following-sibling::RepeatingSegment[1]/@type != 'MAIN01')">
IMAGE ADDED HERE !!
</xsl:if>
Expected:
case 1:
MAIN01 -> POOT -> IMAGE --> SAC
case 2:
MAIN01 ->IMAGE --> POOT
Current status :
case 1:
MAIN01 -> IMAGE --> POOT -> SAC
case 2:
MAIN01 -> IMAGE --> POOT
先感谢您。任何建议表示赞赏。