0
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」の前に PICTURE を挿入したい。

現在の既存のロジックは、外側のループ MAIN01 を通過するだけで、セグメント タイプ = "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

前もって感謝します。どんな提案でも大歓迎です。

4

1 に答える 1

0

Loop 要素の子である最後の Loop 要素の直前に画像を配置したいようです。

<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>
于 2013-04-13T15:19:58.927 に答える