0

xslで出力を生成するためにteamsiteとxslを使用しています。タグを動的に閉じて開く方法を見つけようとしています。問題は次のとおりです。多くのコンポーネントを含むフォーム (チームサイト フォーム) があります。これらのコンポーネントの 1 つは行区切りです。このコンポーネントがフォームに追加されると、出力はこのタグ「ContainerType Row2Col1 ContainerType>」を生成し、コンポーネントを閉じて、コンテナー タグを削除し、タグを再度開きます。これが私がやっている方法です!

RowDivider を追加するかどうかは、ユーザーがページで使用するテンプレートによって異なります。

この方法で...次のエラーメッセージ「ファイルの途中終了」が表示されます。行分割セクションのタグを閉じて再度開くためにこれが発生することはわかっていますが、解決方法がわかりません!!

 <Container>
 <ContainerType>Row2Col1</ContainerType>                    
            <Components>
                <xsl:for-each select="content/ContentContainer">
                    <xsl:for-each select="CTA">
                        <Component>
                        <ComponentType>CTA</ComponentType>

                        </Component>
                    </xsl:for-each>
                    <xsl:for-each select="BodyText">
                        <Component>
                            <ComponentType>BodyText</ComponentType>
                            <Attributes>
                                <Attribute>
                                    <Key>HtmlText</Key> 
                                    <Value>
                                        <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
                                        <xsl:value-of select="BodyText" disable-output-escaping="yes"/>
                                        <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
                                    </Value>                            
                                </Attribute>
                            </Attributes>
                        </Component>
                    </xsl:for-each>
                        <xsl:for-each select="RowDivider">
                                </Components>
                                </Container>
                                <Container>
                                <Components>
                        <ContainerType>Row3Col1</ContainerType>
                        </xsl:for-each> 
                </xsl:for-each> 
            </Components>
        </Container>

これが出力になるはずです

         <Container>
    <ContainerType>Row2Col1</ContainerType>
    <Components>
        <Component>
            <ComponentType>BodyText</ComponentType>
            <Attributes>
                <Attribute>
                    <Key>HtmlText</Key>
                    <Value>
                        <![CDATA[ <p>Text</p>  ]]>
                    </Value>
                </Attribute>
            </Attributes>
        </Component>
        <Component>
            <ComponentType>CTA</ComponentType>
        </Component>
    </Components>
</Container>
<Container>
    <ContainerType>Row3Col1</ContainerType>
    <Components>
        <Component>
            <ComponentType>BodyText</ComponentType>
            <Attributes>
                <Attribute>
                    <Key>HtmlText</Key>
                    <Value>
                        <![CDATA[ <p>Text</p>  ]]>
                    </Value>
                </Attribute>
            </Attributes>
        </Component>
    </Components>
</Container>
4

2 に答える 2