4

I have tried the following code :

<xsl:variable name="xx" select="'40967.6424503935'"/>
<script type="text/javascript">
   time({$xx});
</script>

My intention is to display text via document.write() present in time(). But it didnt give any result.

3 Answers 3

6

The curly braces are for 'Attribute Value Templates', but in this case you are not creating an attribute here, just a normal text node. I think you need to do something like this

<xsl:variable name="xx" select="'40967.6424503935'"/>
<script type="text/javascript">
   time(<xsl:value-of select="$xx" />);
</script> 
Sign up to request clarification or add additional context in comments.

1 Comment

iv got it working like this : var curDate = "<xsl:value-of select="$date"/>"; document.write('<span style="font-size:10px;font-family: arial;font-weight:bold;">['+time(curDate)+"]</span>");
1

There should be a small correction in the above code snippet. The parameter should be passed within single inverted comma.

<xsl:variable name="xx" select="'40967.6424503935'"/>
<script type="text/javascript">
   time('<xsl:value-of select="$xx" />');
</script> 

This will work.

Comments

0
<input type="hidden" id="title" select="{COL[@name='title']}"/>

<script type="text/javascript">
    alert(document.getElementById('title').value);
</script>

This works for me.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

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.