Subject: RE: [xsl] xhtml xslt file: populating javascript array with data from xml file? From: "Dominic J. Blythe" <Dominic.Blythe@xxxxxxxxxxxxxxx> Date: Fri, 29 Jun 2001 09:32:02 +0100 |
this works fine in ie5 to get the answer attribute into position [id attribute] in an array called questions. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" xmlns="http://www.w3.org/TR/REC-html40" result-ns=""> <output method="html" version="4.0" encoding="ISO-8859-1" media-type="text/html"/> <xsl:template match="/"> <script><![CDATA[ questions = new Array(); ]]></script> <xsl:apply-templates select = "question"/> </xsl:template> <xsl:template match="question"> <script>questions[<xsl:value-of select="@id"/>] =<xsl:value-of select="@answer" />;</script> </xsl:template> </xsl:stylesheet> I expect something similar is possible in any xslt interpreter. Anthony E wrote: > > any ideas on how i can set the variables/arrays in my > javascript with data from my xml file? > <question id="1" answer="2"> What time is it? <choice id="1">a) daytime</choice> **(close the tag you openened) <choice id="2">b) nighttime</choice> ** <explanation>answer is "b" because it is dark outside.</explanation> </question> ______________________________________________________________________ Dominic Blythe Programmer BCP Ltd BCP House, 151 Charles St, Stockport, SK1 3JY UK t: 0161 355 3000 f: 0161 355 3001 e: dominic.blythe@xxxxxxxxxxxxxxx _____________________________________________________________________ /* It's nice to be important, but it's more important to be nice */ > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xhtml xslt file: populati, Anthony E. | Thread | ie namespace and doctype was Re: [x, cutlass |
RE: [xsl] xhtml xslt file: populati, Chris Bayes | Date | RE: [xsl] ISO-8859-1 characters in , Jarno Elovirta |
Month |