0

変数を使用してテンプレート マッピングを取得したいのですが、その XSl スタイルシートの vxml 形式を作成するために使用ます

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:strip-space elements="*" />
    <xsl:output method="xml" version="1.0" encoding="UTF-8" />

    <xsl:template name="temp1" match="message">
        <form>
            <block>
                <audio>
                    <xsl:attribute name="src1">
                        <xsl:value-of select="audio1/@src1" />
                    </xsl:attribute>
                    <xsl:value-of select="audio1" />
                </audio>
            </block>
        </form>
    </xsl:template>

    <xsl:template name="temp2" match="message">
        <form>
            <block>
                <audio>
                    <xsl:attribute name="src2">
                        <xsl:value-of select="audio2/@src2" />
                    </xsl:attribute>
                    <xsl:value-of select="audio2" />
                </audio>
            </block>
        </form>
    </xsl:template>

    <xsl:template name="temp3" match="vxml">
        <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.w3.org/2001/vxml  http://www.w3.org/TR/voicexml20/vxml.xsd">
            <xsl:call-template name="temp1" />
        </vxml>
    </xsl:template>

</xsl:stylesheet>

tem1を実行したり、 tem2を実行したりします。あなたはそこに変数を使用することができます(変数はjavaに入っています)変更テンプレートはどのようにコードを開発しますか?以下のコードは、Java 値をキャッチするために使用します

<xsl:attribute name="src2">
    <xsl:value-of select="audio2/@src2" />
</xsl:attribute>
<xsl:value-of select="audio2" />

これはJavaからのパス文字列です

String var = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                        + "<vxml>" 
                        + "<audio src=\"" + getFullPath + "\"/>" 
                        + "</vxml>";

コードの開発方法

ありがとう。

4

0 に答える 0