[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xhtml xslt file: populating javascript array with
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|