Xml XSLT逻辑排序-放置图像 案例1: 1. F C 案例2: 1. F
在场景中,我想在案例1中的“SAC”之前插入一张图片,在案例2中的“POOT”之前插入一张图片 当前的现有逻辑只是通过outter循环MAIN01,在段type=“MAIN\u 01”的末尾插入图像。这意味着在案例1中,图像显示在“POOT”之前Xml XSLT逻辑排序-放置图像 案例1: 1. F C 案例2: 1. F,xml,xslt,Xml,Xslt,在场景中,我想在案例1中的“SAC”之前插入一张图片,在案例2中的“POOT”之前插入一张图片 当前的现有逻辑只是通过outter循环MAIN01,在段type=“MAIN\u 01”的末尾插入图像。这意味着在案例1中,图像显示在“POOT”之前 CASE 1: <Loop type="MAIN01" name="MAIN01 Data"> <RepeatingSegment type="MAIN01" name="MAIN REP SEG">
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:
MAIN01->POOT->图像-->SAC
案例2:
MAIN01->图像-->POOT
当前状态:
案例1:
MAIN01->图像-->POOT->SAC
案例2:
MAIN01->图像-->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
--形象--
<xsl:template match="Loop">
<xsl:if test="parent::Loop
and (
generate-id(parent::Loop/Loop[last()])
=
generate-id(.) )">
-- image--
</xsl:if>
<xsl:apply-templates />
</xsl:template>