1

I have an xsl where I have to include a javascript, for which the src link is received from a web service response.

The service response xml looks like this:

<value>
  <scripturl>http://www.example.com/js/example.js?apikey=12345</scripturl>
</value>

and the script tag I have added in the xsl (I already have read the scripturl value in xsl and set in xsl variable named scripturlxsl) looks like this:

<script type="text/javscript" src="{scripturlxsl}"></script>

How would I make it work, as the page is not loading the script

0

1 Answer 1

2

If the script url value is already in a variable, then this is what you would do:

<script type="text/javscript" src="{$scripturlxsl}"></script>
Sign up to request clarification or add additional context in comments.

2 Comments

does 'xsl:attribute' work in this case? just tried that and it did not work. but it worked on image. am i missing the basic?. Your code worked for me. thanks.
Yes, you could use xsl:attribute. In that case, you would put this between the script tags: <xsl:attribute name="src"><xsl:value-of select="$scripturlxsl" /></xsl:attribute>. As I think you can see, there wouldn't be any benefit to using xsl:attribute in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.