0

I want get template mapping using variable, I use for create vxml format for that XSl stylesheet how to it get blow xsl sheet

<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>

I want some time run tem1 and some time run tem2. you can use there variable(variable come in java ) change template how I develop the code? below code use for catch java value

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

This is the pass string from java

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

How I develop the code?

Thanks.

Thilina Sampath
  • 3,615
  • 6
  • 39
  • 65
  • You forgot to explain *when* you want to run the different templates, and *why*. – Tomalak Sep 04 '15 at 07:14
  • I want create lot vxml. one stylesheet that reason for use different templates . I before try to lot of way (http://stackoverflow.com/questions/32249612/how-to-get-output-as-xml-in-jax-rs-web-service-using-spring-mvc-view-resolver) to create vxml but fimnal deside this way.. – Thilina Sampath Sep 04 '15 at 08:10
  • Sorry, but your questions do not make a lot of sense to me. – Tomalak Sep 04 '15 at 08:32
  • is used lot of template join and create for vxml format. how to map a template to another template . main problem is how to map difference situation in change temp2 as.... – Thilina Sampath Sep 04 '15 at 08:54
  • I'm sorry to say it, but your English is not good enough to explain the issue. I can't understand anything you write. – Tomalak Sep 04 '15 at 08:56
  • sorry about that. but I want to map template with change **temp3** into temp2 and temp3 that's all. using xsl variable. – Thilina Sampath Sep 04 '15 at 09:10

0 Answers0